Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Resultant Field Post Reply Post New Topic
Author Message
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Topic: Resultant Field
     Posted: 18 Dec 2013 at 7:55am
Hi,
 
I have the following data in two tables. Table 1 is joined to Table 2 through a left outer join. I want to further filter the data to reflect only the rows where Table 1 Location is not equal to Table 2 Assigned location. If i apply this formual i am missing the row for item # 3708036 and 1200223. I need this to be reflected along with the item 0486024. Can anyone help me with this.
 
Hem Reddy
                         TABLE 1 TABLE 2
Item# Load # Location qty Assigned Location
3708036 B0000173831 D1K1610A 12
0486024 B0000195340 MISSING 50 D1F3110A
4001311 B0000206793 C1G3710A 35 C1G3710A
1840550 B0000220167 D1G2610B 70 D1G2610B
1840550 B0000220167 D1G2610B 90 D1G2610B
1206777 B0000223349 C1D3110B 45 C1D3110B
1203614 B0000226644 D1C2210A 70 D1C2210A
1200223 B0000226650 D1A1710A 60
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Dec 2013 at 8:10am
in you select statement make sure that you use the pick list option set to  'use default values for nulls'
then use the formula
table1.location <> table2.assignedlocation
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 18 Dec 2013 at 9:49am
Hi,
 
Thnak you very much. But i ran into another problem. In the sale example if for one load number The location is equal to one of the assigned location i need that to be out of the report.
 
Say for load # 123 the location is x1 and the assigne dlocation is x1 and x2, sine the load satisfies one of the assigned location i need that to be excluded from the report.
 
I would very much appreciate if you could let me know the solution.
 
Thanking you,
 
Hem Reddy
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Dec 2013 at 9:54am
are the assigned locations stored as multiple on rows or a just one row with a one string with multiple values?
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 18 Dec 2013 at 10:00am
Hi,
 
They are stored in multiple rows and the data is being pulled because of the outer join.
 
Hem Reddy
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Dec 2013 at 10:10am
this is then a group condition and a group exclusion.
this can be done more efficiently via a stored procedure (or the like) but can be done in crystal.
remoev your select statement condition
create a 'flag' formula (set it to use default values for nulls)
if table1.location = table2.assignedlocation then 1
group on the load field
insert a summary as the sum of @flag at the load group level
you now should see that any load group that has a sum> 0 are the ones you want to exlcude
open the group select and add your condition there
sum(@flag,table.loadfield)=0
 
note that the group select happens in a later data pass. Any summary calculations you that you want to limit on the group selected items have to use running totals or shared variables to exclude and calculate as you desire.
Summary functions are done in a pass that is before group selection (hence the ability to use it as a condition).
Also all groups appear in the group tree as it is created before the group criteria is applied.
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 18 Dec 2013 at 10:29am
Hi Mr. Blank,
 
I have Crystal 2008. Don't know how to create a "flag" formula. This is what i did. I grouped the report by load number and tried the formula if Location = assignede location then 1 else 0 and i am getting an error saying boolean is required.
 
Hem Reddy
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 18 Dec 2013 at 10:42am
Dear Mr. Bank,
 
I got it. Thank u very much.
 
Hem Reddy
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Dec 2013 at 10:42am
a flag formula is just a formula field that I named 'flag' as its purpose is to be able to flag rows (and eventually a group) that meet a condition.
YOu have to go to the field explorer and add New to the a formula field section.
The boolean error you got was likely becasue you stuck the formula in the select expert. You can add a condition in the select expert but it requires the result to be either True (include the row) or False (exlcude the row).
Adding formulas to the report is done in the Field Explorer: Formula Fields section.
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