on 08-24-2012 11:49 AM
Hi everybody,
I am using Crystal Reports 2008.
In Field Explorer, I have a formula field called "Error" which contains the following code:
If (InStr(Join({?BankAcctNumber}), "Euro") > 0 AND "EUR" in {Command.Currency}) THEN "This is an Error!"
A brief explanation:
The JOIN command joins several user-selected choices together. E.g if User selects "Euro" and "Dollar", JOIN returns the string "EURO, DOLLAR"
"BankAcctNumber" is a parameter field in CR
The INSTR command checks whether a given substring (here "Euro") is found within a given String (here INSTR etc... )
= 0 means that the Substring is not found
> 0 means that the Substring is found somewhere in the main string.
What my code means is the following:
If the user selects "Euro" AND the currency (in detail section) is "EUR" , then the Error message is displayed.
I want to modify my code so that it reads:
If the user selects "Euro" AND the currency (in detail section) is NOT "EUR" , then the Error message is displayed.
How can I do this?
Thanks
Leon Lai
PS:
I tried the foll, and although there is no error, it does not work as expected:
IF (InStr(Join({?BankAcctNumber}), "Euro") > 0)
AND
not( "EUR" in {Command.Ccy})
then "This is an Error!"
Hi Leon Lai,
try it on multiple levels:
iif(
InStr(Join({?BankAcctNumber}), "Euro") > 0,
iif("EUR" not in {Command.Ccy},
"This is an error",
"OK")
,"OK")
also what do you mean by not working as expected?
Regards,
D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
97 | |
8 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.