Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF THEN ELSE "Select Expert" - Formula

Status
Not open for further replies.

brians0friends

Technical User
Feb 6, 2002
4
US
Under the "Select Expert" - Formula
In the first example it pulls "*a" from the "CK_BED_SPACE" field but in the second example it pulls "*A" and "*a" from the "CK_BED_SPACE" field. I don't want it to pull the "*A" (ex. 101A) but instead only the "*a" (ex. 101a) from the field. I need to run the second script, example two, because I have multiple criteria for the capacity. For instance if "capacity" = 3 then pull "bed_space" *a, *b, *c. Next statement is if "capacity =2 then pull "bed_space" *a, *b. I have multiple statements to run so I connected them using an "else", but once I did this the statements pulled the additional "*A", which I do not want. HELP




Example one:

IF {RMGT_T_ROOM_CONFIGS.ROOMS_CAPACITY} = 3 then
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*a" or
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*b" or
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*c"


Example 2:

IF {RMGT_T_ROOM_CONFIGS.ROOMS_CAPACITY} = 3 then
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*a" or
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*b" or
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*c"

else
IF {RMGT_T_ROOM_CONFIGS.ROOMS_CAPACITY} = 2 then
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*a" or
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*b"


 
I think parentheses would help it evaluate the way you want, but using IF-THEN-ELSE or OR logic for selection tends to kill performance. I would try:

{RMGT_T_ROOM_CONFIGS.ROOMS_CAPACITY} in [ 2, 3] and
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like ["*a", "*b", "*c" ] and

Not ( {RMGT_T_ROOM_CONFIGS.ROOMS_CAPACITY} = 2 and
{RMGT_T_ROOM_CONFIGS.CK_BED_SPACE} like "*c" ) Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top