Joined: 31 Mar 2011
Location: United Kingdom
Online Status: Offline
Posts: 3
Topic: if then else.... Posted: 31 Mar 2011 at 1:28am
I'm attempting to report on a SQL database using Crystal Reports, and I've managed to get quite far before getting stuck. My current setup shows if a record meets a condition, it then shows a text field based on that:
if {Calibrations.Preset} = True then 'Preset Value:' else 'Max Capacity:'
What I'd like to do is extend that a bit, so that if {Calibrations.Preset} = True then not only does it display 'Preset Value:', but it also displays the {Calibrations.PresetValue} variable, or if not, then it displays the {Calibrations.MaxCapacity} variable after 'Max Capacity:'
I've had a play around with the syntax, and had a thorough Google, but I don't seem to be able to find what I need. Does this make sense to anyone out there please?
Joined: 22 May 2009
Online Status: Offline
Posts: 347
Posted: 31 Mar 2011 at 2:07am
You need to concatenate the text with the variable using &. Be sure to put a space within the quotes so that the string does not butt up too close to the variable:
if {Calibrations.Preset}=True
then 'Preset Value: ' & {Calibrations.PresetValue}
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