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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Literal use of * (Not as a wildcard)

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
Unfortunately one of our customer types is an *. I’m in the process of creating a formula that is looking at the customer type and then performing this calculation “else if {MNCML199.CTYPE} = "*" then {OBCOL296.ACTSP}. I’m not getting the desired results. Thanks for the help.
 
hi
please give more detail
what version of crystal
what formylu is used
please paste the formula to help us give you assistance


cheers



pgtek
 
You know after I sent this I told myself you forgot to state the Version.

I’m on Version 7 (still)

I provided a snippet of the formula, but here is the full formula

if {OBCOL296.C2SYN} like ['M*', 'Q*', 'T*', 'W*', 'Z*']
and {MSCML199.CTYPE} like "M*"
then {OBCOL296.LISTP} * .50
else if not ({MSCML199.CTYPE} like "M*")
then {OBCOL296.LISTP} *.64
else if {MSCML199.CTYPE} = "*"
then {OBCOL296.ACTSP}
else if not({OBCOL296.C2SYN} like ['M*', 'Q*', 'T*', 'W*', 'Z*'])
then {OBCOL296.ACTSP}

I have been working with this since my posting and if I move the if {MSCML199.CTYPE} = "*" higher in the formula I’m getting the desired results thou I’m still working on it.
 
How about changing the "*" character to somethingelse before running this test

try this
//@*Calc

WhilePrintingRecords;
StringVar OBCOL296test := replace({OBCOL296.C2SYN},"*","$");
StringVar MSCML199test := replace({MSCML199.CTYPE},"*","$");

if OBCOL296test like ['M$', 'Q$', 'T$', 'W$', 'Z$']
and MSCML199test like "M$"
then {OBCOL296.LISTP} * .50
else if not (MSCML199test like "M$")
then {OBCOL296.LISTP} *.64
else if {MSCML199test = "$"
then {OBCOL296.ACTSP}
else if not(OBCOL296test like ['M$', 'Q$', 'T$', 'W$', 'Z$'])
then {OBCOL296.ACTSP},

unless there are already "$" this should work...if there is "$" choose some other char


Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
You can also try using the chr(42) instead.


if {MNCML199.CTYPE} = chr(42) then {OBCOL296.ACTSP}


Lisa
 
It's the LIKE that's getting you, try:

if left({OBCOL296.C2SYN},2) in ['M*', 'Q*', 'T*', 'W*', 'Z*']
and left({MSCML199.CTYPE},2) = "M*"
then {OBCOL296.LISTP} * .50
...

You get the idea...

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top