on 05-25-2011 4:57 PM
In my data I have a field that holds three pieces of info seperated by a comma.
Im using SPLIT to split them out and that works just fine.
In this example the piece of data that I'm pulling out could be one of four things. Part [3] of my array in the code below could return:
In the host city
Under 50km
50-100km
Above 100km
I'm trying to have Crystal return either 'In the City' or 'Outside the city'. So if [3] = "In the city", then I want it to print "In the city". Otherwise I need the value to be "Outside the city".
Below is my chicken scratch formula that doesnt work, if someone could point out my failings and how to correct them I would be most appreciative.
Local stringvar x:= SPLIT ({TABLE.DATA}, ", ") [3]
If x = "In The Host City"
Then "In The City"
Else "Outside The City"
Hi
Try the following :
stringvar x:='This is my ciry';
if InStr(x,'This is my') = 1 then
"Inside city"
else "Outside City"
Thanks,
Sastry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot for the feedback guys.
After your pointers I eventually went with the below and the results are spot on.
stringvar x:= SPLIT ({DATA.TABLE}, ", ") [3];
if InStr(x,'In The Host City') = 1
then "Inside The City"
else "Outside The City"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Remember the string is case-sensitive so if there is a possibility of the string in a strange format also try using the Uppercase function before comparing.
The InStr as mentioned would also be a good idea. There could be spaces, etc.
Good luck,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.