Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula 'if-then' statement Post Reply Post New Topic
Author Message
Dangerhat156
Newbie
Newbie
Avatar

Joined: 05 Dec 2012
Location: United States
Online Status: Offline
Posts: 4
Quote Dangerhat156 Replybullet Topic: Formula 'if-then' statement
     Posted: 06 Dec 2012 at 8:53am

Apologies if this is a cross-post, but i couldn't find what i was looking for in previous posts...  Also fairly new to CR.

I'm trying to get a formula to look at multiple values assigned to a specific value and return an "X" based on if one of these values is met. 
 
There's a specific weld that can have multiple and different weld test types assigned to it:
 
  weld1234   
     --> Exam Requested=true (checkbox in DB)
     --> Test Type required: RT
     --> Test Type required: MT
     --> Test Type required: BHN
     --> Test Type required:BHN
 
Within the same group {WeldID}, I need to show each weld test type required with that weldID with an "X".  So for the example above, i should see an "X" for RT, an "X" for MT, and an "X" for BHN (multiple of the same test type does not need to be counted)
 
The formula below is what i thought would have worked for RT (I double checked the record to make sure it was actually assigned to the weld)
 
   if{ttx[3500]_ttx.Welds~ExamRequested}=true
   and {ttx[3500]_ttx.Weld Test Type~PipeWeldTestType}="RT"
   then "X"
 
Unfortunately it does not return anything, even though RT is assigned to most all of the welds...
 
Any suggestions?
 
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 06 Dec 2012 at 10:15am
are you sure the value in the database is actually "true", and 'x' in my application = 'CHECKED' or even a '1' in some situations.
IP IP Logged
Dangerhat156
Newbie
Newbie
Avatar

Joined: 05 Dec 2012
Location: United States
Online Status: Offline
Posts: 4
Quote Dangerhat156 Replybullet Posted: 06 Dec 2012 at 10:27am

In SQL that field registers as a 1/0/-1, but when i try these values in CR, it prompts me to enter a boolean value.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Dec 2012 at 11:23am
place the two fields on the detail section and see if you get the values you expect. I have a feeling that you have an join issue rather than a formula issue

Edited by DBlank - 06 Dec 2012 at 11:24am
IP IP Logged
Dangerhat156
Newbie
Newbie
Avatar

Joined: 05 Dec 2012
Location: United States
Online Status: Offline
Posts: 4
Quote Dangerhat156 Replybullet Posted: 07 Dec 2012 at 8:48am

Thanks for the suggestion - gave it a shot, however it didn't work out.  I tried inserting a subreport that linked on the WeldID, and it's close; but it's returning a value for each welder associated with the weldID. 

Each weld is represented by a unique WeldID and each WeldID can have multiple WelderIDs as well as multiple Weld Test Types. 
 
The subreport is currently in the WeldID group level, and is linked on WeldID.  It returns the correct weld test type, but it returns it twice, one for each welder on this particular weld.  Works like a charm if there's just one welder though...haha 
 
 
Here's a look at my Grouping:
Project (supressed)
- ISONumber (supressed)
  - WeldID (Active group w/fields)
    - Details (supressed
IP IP Logged
Dangerhat156
Newbie
Newbie
Avatar

Joined: 05 Dec 2012
Location: United States
Online Status: Offline
Posts: 4
Quote Dangerhat156 Replybullet Posted: 12 Dec 2012 at 6:55am
Success!
Finally got the fields to populate correctly.  I added another group (PipeWeldTestID) below the WeldID group, then relocated my data from the WeldID header to the WeldID footer, and supressed the header.
To get multiple fields to show for one record, i used a running total and a formula to display when multiple weld types were used on one record.
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