Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: what should i do? Post Reply Post New Topic
Author Message
kevincloud999
Newbie
Newbie


Joined: 09 May 2008
Location: Japan
Online Status: Offline
Posts: 6
Quote kevincloud999 Replybullet Topic: what should i do?
    Posted: 09 May 2008 at 8:31am
hello i have a little prob.

i have 4 tables

1. invoice table (currenly invoice)
2. dyinvoice table (history invoice)
3. gl invoice (currenly the gl invoice)
4. dy gl invoice ( history gl invoice)

in the invoice table the first invoice number is 1245 and in the dyinvoice table the first invoice number is 1 and the last is 1244

and the gl invoice the first record would start at 1245 and the dy gl invoice the first record would be 1 and last would 1244

what i want to do in crystal reports is i want a field that would start from invoice 1 to the last invoice number and a field for the same with both the gl tables

kinda like merge the invoice tables into one field so is start from invoice 1 and to the last also for the gl tables


thank
kevin

IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 12 May 2008 at 4:47am
To get all four tables in one report is going to be a bit tricky.  You are going to need to use a SQL Command object (instead of adding the tables to the report, you will use Add Command to add a query).

The query will look something like:

SELECT * FROM
    (SELECT * FROM invoice
     UNION ALL
     SELECT * FROM dyinvoice) inv_union
JOIN
    (SELECT * FROM gl_invoice
     UNION ALL
     SELECT * FROM dy_gl_invoice) gl_union
ON inv_union.inv_num = gl_union.gl_num



If you've never used UNION before, you need to know that the columns for both halves of the UNION need to line up.  E.g., you can't have an extra "date archived" column in the middle of the dyinvoice table.  For that reason, never actually use the "SELECT *" phrase.  By listing out the columns, it is much easier to make sure they line up.


IP IP Logged
kevincloud999
Newbie
Newbie


Joined: 09 May 2008
Location: Japan
Online Status: Offline
Posts: 6
Quote kevincloud999 Replybullet Posted: 12 May 2008 at 6:18am
thank Lugh i am doing so now will let you know what is the out come

thank again
IP IP Logged
kevincloud999
Newbie
Newbie


Joined: 09 May 2008
Location: Japan
Online Status: Offline
Posts: 6
Quote kevincloud999 Replybullet Posted: 12 May 2008 at 6:24am
oh lugh i forgot to tell you my data source is Visual Foxpro database connecting use ODBC 
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 12 May 2008 at 6:42am
I don't think that should be an issue.  I have never used FoxPro, but it should support UNION queries.  It's ANSI standard and all.


IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.