cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Report if statement

06-01-2021 6:55 AM
984 views 3 comments
0 Likes
SAP Managed Tags
Subscribe

I have a crystal report that is created by linking the table to create the sql query. The query is pulling: Job#, CustomerName, Plant, and DefineDate. When I run the report it pulls back the data correctly but I want it to leave a blank for the DefineDate if the job is a certain status. I created a formula field called DefineDate and put this if statement in there:

if {SSLOM.SearchKey} = {IPJOBM.JOB_NUMBER} and {SSLOM.DataItem}= "Def Rec DT" then {SSLOM.AlphaValue} else " "

(This is saying if fields match, which is the job# and the status is 'Def Rec DT' print out the data else leave blank.)

When I ran the report with this if statement it returned blanks for all the rows returned, but some of them should have returned data.

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member566317
Active Participant

Hi ,

your logical expression might not return expected result.

and also check the below statement.

if TOTEXT({SSLOM.SearchKey}) = TOTEXT({IPJOBM.JOB_NUMBER}) and TOTEXT({SSLOM.DataItem})= 'Def Rec DT' then {SSLOM.AlphaValue} else ' '

DellSC
Active Contributor
0 Likes

If you needed ToText to convert something so that they match, Crystal would throw an error. So this is not needed.

DellSC
Active Contributor
0 Likes

Are you sure that the "Def Rec DT" string is in the right case and is an exact match to what's in the data? I might also take out the "else" part of the if statement - like this:

if {SSLOM.SearchKey} = {IPJOBM.JOB_NUMBER} and UpperCase({SSLOM.DataItem})= "DEF REC DT" then 
  {SSLOM.AlphaValue} 

If that doesn't work, you'll need to do some debugging. For this, I would first take out

and UpperCase({SSLOM.DataItem})= "DEF REC DT"

and see whether the date shows up. If it does, then there is an issue with the string comparison. If it doesn't, then the issue is with the SearchKey/JOB_NUMBER comparison.

-Dell