Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Urgent! How to display a record from differ table Post Reply Post New Topic
Page  of 2 Next >>
Author Message
angelyin1984
Newbie
Newbie
Avatar

Joined: 08 May 2009
Location: Malaysia
Online Status: Offline
Posts: 30
Quote angelyin1984 Replybullet Topic: Urgent! How to display a record from differ table
     Posted: 13 Jul 2009 at 12:57am
Helo...Let say if i want display only one field from each table, and showing togather in one report. how do i need to write for the coding part?
 
For example Table A, i want show the field school name_A, Table B, i want to show the field school name_B, Table C show the field school name_C.
 
i want show this 3 field in a report by vertically.
 
 
School name_A | School name_B | School name_C
                         |                          |                         
                         |                          |                           
                         |                          |        
                 
(School name_A,School name_B and School name_C is from 3 different table's field)
 
 
crystal report XI
 
Field Explorer:
 
Formula Fields:
Status(this part i not sure need how to write the code)
 
Parameter Field:
-UserID
-Facility
-Status
 
 
pls help.
 
thanks in advance.
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 Jul 2009 at 7:22am
well once you have joined the tables, so that a 'row' of data is all related, you would just drag and drop the fields onto the report, next to each other.
 
Am I missing something?  Is there some other complexity that you haven't told us?
 
HTH
IP IP Logged
mrc161
Newbie
Newbie


Joined: 27 Dec 2007
Location: United States
Online Status: Offline
Posts: 19
Quote mrc161 Replybullet Posted: 13 Jul 2009 at 7:48am
You might try grouping the report by the field that links the three tables, and do a Maximum on each of those fields in the header or footer of that group.
 
Then hide the Details section.  Might work.
IP IP Logged
angelyin1984
Newbie
Newbie
Avatar

Joined: 08 May 2009
Location: Malaysia
Online Status: Offline
Posts: 30
Quote angelyin1984 Replybullet Posted: 13 Jul 2009 at 6:41pm
i want the School name_A,School name_B and School name_C display the same name when i choose the status, let say School name_A have the name SMK ,School name_B also have the name SMK and School name_C also have the name SMK, i want is when i choose the status i want to display "SMK" record, then will show the "SMK" record at each column.
 
now is i not sure how to write the code at "Status" there to ask display "SMK" when i choose "SMK"
 
can understand?
thank you very mush in advance ya.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Jul 2009 at 6:07am
Sounds like you want to display only records that have a status of SMK.
 
I am assuming that your tables are linked correctly, so what I think you are looking for is how to filter the data.
 
If this is what you are lookng to do, I would create a parameter, call it status, it will appear as {?status}.  In Report/Selection Formula/Record add a line like:
{table.status} = {?status}
 
the only records that will be displayed are the ones that have the status.  If you need to have all 3 tables match, because there are multiple statuses, just make something like:
{table1.status} = {?status}
and
{table2.status} = {?status}
and
{table3.status} = {?status}
 
Hope this helps
IP IP Logged
angelyin1984
Newbie
Newbie
Avatar

Joined: 08 May 2009
Location: Malaysia
Online Status: Offline
Posts: 30
Quote angelyin1984 Replybullet Posted: 14 Jul 2009 at 9:02pm
yup...success done. thank you very much.
 
but now got another question, now i successful done is when i choose'smk' then each table will display 'smk'.
 
If i want to let user to select either user want to display match record for each table or other else.
 
For Example:
if user choose "match" then record will display all match record. Look like below;
School name_A  | School name_B | School name_C
SMK                    | SMK                  |SMK                 
 
Else
if user choose "not match" then the record will display all  not match record,and will show like below;
School name_A | School name_B | School name_C
SMK                   | KDU                  |SMK                  
KDU                  | KDU                  | SMK                   
SMK                  | SMK                  | KDU                 
 
Thanks for your reply.


Edited by angelyin1984 - 14 Jul 2009 at 9:05pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Jul 2009 at 6:08am
put an IF statement around what you did before.
 
if {?match}="match" then (
 {table.status} = {?status}
)
 
it should work
IP IP Logged
angelyin1984
Newbie
Newbie
Avatar

Joined: 08 May 2009
Location: Malaysia
Online Status: Offline
Posts: 30
Quote angelyin1984 Replybullet Posted: 15 Jul 2009 at 11:25pm
i not very sure the next step is how i need to do......below is what i understand to do until;
 
1. set at Field Explorer -> Parameter Field -> add New
     Name:Status
     Type:String
(?Status)
 
2. set at Field Explorer -> Formula Fields -> add New
    Name:Status
    Coding Part: if {?Match} = "Match" then (
                                      {table1.status}={?Status} and
                                      {table2.status}={?Status} and
                                      {table3.status}={?Status} )
(@Status)
 
3. Report ->Selections Formula -> Record
     {table1.status}={?Status} and
     {table2.status}={?Status} and
     {table3.status}={?Status}
   *When at this step, system will required "A boolean is required here
     (?Status))
 
i know is something wrong already, but i no idea how to correct it.
 
thanks


Edited by angelyin1984 - 15 Jul 2009 at 11:33pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 Jul 2009 at 6:18am
I would have put #2 in the selection formula...maybe:
 
if {?Match} = "Match" then (
                                      {table1.status}={?Status} and
                                      {table2.status}={?Status} and
                                      {table3.status}={?Status} )
else
 true
 
 
this way, when Crystal is reading the data, it either trys to match and discards 'bad' records or it lets all records in.
 
HTH
IP IP Logged
angelyin1984
Newbie
Newbie
Avatar

Joined: 08 May 2009
Location: Malaysia
Online Status: Offline
Posts: 30
Quote angelyin1984 Replybullet Posted: 16 Jul 2009 at 7:15am
if match then put like this
if {?Match} = "Match" then (
                                      {table1.status}={?Status} and
                                      {table2.status}={?Status} and
                                      {table3.status}={?Status} )
 
while if not match? need how to write for it?
IP IP Logged
Page  of 2 Next >>
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