Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Multiple records Post Reply Post New Topic
Author Message
Plucky
Newbie
Newbie
Avatar

Joined: 11 Mar 2014
Online Status: Offline
Posts: 4
Quote Plucky Replybullet Topic: Multiple records
     Posted: 11 Mar 2014 at 10:17pm
Hi

Im trying to create a report that uses multiple tables that makes up a invoiced job.
Each line has a unique job number with fields such as Customer, Subject, Machine, Job category and Invoice price.

The Machine and Job Category data is stored in a different table along with hundreds of different items in MySQL but it seems
when I run my report all of these items display each in there own row.

Ive created two Formula fields as below:

Job_Category Formula Field =   If {Jobinfos1.Infold} = Job_Category   then {Jobinfos1.Val}   else """"

Machine        Formula Field =   If {Jobinfos1.Infold} = Machine   then {Jobinfos1.Val}   else """"


Job No      Subject      Machine      Job_Category      Invoice price.
700001     Mars                                                        £2020.44
700001     Mars                                                        £2020.44
700001     Mars                                New                  £2020.44
700001     Mars                                                        £2020.44
700001     Mars                                                        £2020.44
700001     Mars          Bobst                                      £2020.44
700001     Mars                                                        £2020.44

It should look like this:

Job No      Subject      Machine      Job_Category      Invoice price.
700001     Mars          Bobst              New                  £2020.44
700002     B&Q           Martin             New                  £781.23
700003     Mars          Bobst               New                  £658.34
700004     Tesco        Gopfert            New                  £1010.00
700005     Tesco        Gopfert        Replacement          £452.00

does anyone have any idea how I can get this to work as I only need one line to appear per job no with the machine data and job category in the same line.
Regards
Plucky
IP IP Logged
marius.raileanu
Newbie
Newbie


Joined: 01 Mar 2014
Location: United Arab Emirates
Online Status: Offline
Posts: 5
Quote marius.raileanu Replybullet Posted: 12 Mar 2014 at 1:21am
create a group :) should work
IP IP Logged
Plucky
Newbie
Newbie
Avatar

Joined: 11 Mar 2014
Online Status: Offline
Posts: 4
Quote Plucky Replybullet Posted: 12 Mar 2014 at 6:54am
Is there no way that crystal reports can just add the result of my IF statement and ignore all the other records in the table without creating a group.
Maybe a SQL field to select the matching data.
Regards
Plucky
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Mar 2014 at 7:48am
did you join the tables 'correctly'?
IP IP Logged
Plucky
Newbie
Newbie
Avatar

Joined: 11 Mar 2014
Online Status: Offline
Posts: 4
Quote Plucky Replybullet Posted: 12 Mar 2014 at 10:13am
I believe they are joined correctly it's just I'm asking to display the value field if infold is equal to job_category and what I need it to do is only display the matching field and ignore the other records.
My If statement ends with. Else """" which creates the multiple blank rows for the values that don't equal job_category. Is there a formula that displays the correct value and ignores the wrong ones.
Regards
Plucky
IP IP Logged
marius.raileanu
Newbie
Newbie


Joined: 01 Mar 2014
Location: United Arab Emirates
Online Status: Offline
Posts: 5
Quote marius.raileanu Replybullet Posted: 12 Mar 2014 at 10:23am
You can group by Job no and select max for the other columns.
Anyway it looks like you have in 1 table 1 more then row with Job No and the other column you select so you should select distinct at the begining and then join the tables :)

Edited by marius.raileanu - 12 Mar 2014 at 10:24am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Mar 2014 at 10:32am
Your IF-THEN statements really look like join criteria.
Look in the Database expert at the joins tab and see how your tables are joined.
 
What is the set up there?
IP IP Logged
Plucky
Newbie
Newbie
Avatar

Joined: 11 Mar 2014
Online Status: Offline
Posts: 4
Quote Plucky Replybullet Posted: 17 Mar 2014 at 5:17am
Hi
The joining of the tables look correct.

I have created a pdf showing the relationship between the tables but doesn't seem like I can attach the file anywhere.

Regards
Plucky
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Mar 2014 at 5:34am
under Database there is a "show SQL query" option.
if you run that can you post it...at least the from and where portions?
IP IP Logged
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