Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Combining two parameters in one comment Post Reply Post New Topic
Author Message
LBergh
Newbie
Newbie


Joined: 11 May 2010
Location: Netherlands
Online Status: Offline
Posts: 1
Quote LBergh Replybullet Topic: Combining two parameters in one comment
     Posted: 17 May 2010 at 9:41pm
I have to combine the results of two parameter to generate one comment. How can I do this?
When parameter A is negative and B is negative I need comment 1
When parameter A is positive and B is negative I need comment 2
When parameter A is negative and B is positive I need comment 3
When parameter A is positive and B is positive I need comment 4
 
I tried to use:
if {METHOD.NAME} like 'parameter A' and {SAMPLEPARAM.RESULT} like 'negative' then
if {METHOD.NAME} like 'parameter B' and {SAMPLEPARAM.RESULT} like 'negative' then 'Comment 1' else
 
and so one, but that doesn't work.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 May 2010 at 3:13am
if instr({METHOD.NAME}, 'parameter A') > 0 and  instr({SAMPLEPARAM.RESULT}, 'negative') then ....
 
'like' is a sql command, the closest analog would be if the string exists, and instr() does that, providing the starting location of the string in a 1 based count, so 0 means doesn't exist in the string, any number >0, the value exists.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 May 2010 at 4:08am
Just for clarification LIKE can be used here. It call also be used with a * for multiple character repalcement or a ? for a single character replacement.
examples of use:
{table.field} LIKE "d*g" would return all records that start D and end with  G regardless of the length of the string.
{table.field} LIKE "d?g" would return all records that are a length of 3 and that start D and end with G.
{table.field} LIKE "*dog*" would return all records that have the string of dog anywhere in the field.
{table.field} LIKE "*d?g*" would return all records that have the string of "d+any one character+g" anywhere in the string.
etc.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 May 2010 at 3:37am
ahh...learn something new everyday...
 
Thanks
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