|
-
XMPie help
I need to know how to write an if statement for if "chips" was in a text string "gaming chips", then to put another string in. The problem we're having is the field has different denominations and we would have to make a ton of statements so if we can search the field for just the one word that would be better. Thanks ahead for any advice.
-
Here you go.
Use Find function. It will return the starting position of string you are searching for, if the string is not found it will return -1. When any other value is returned you can then set the replacement string with your if statement.
Find (data to evaluate, expression your looking for, starting position [note 0 is the first character])
If (Find(|->[field1],"chips",0) = -1
|->[field1]
else
replacement string
If you are trying to replace "chips" with "tokens" but want to leave all the other text in the original string intact use the FindAndReplace Function.
FindAndReplace (data to evaluate, expression your looking for,replacement value)
FindAndReplace (|->[field1], "chips","tokens")
if |->[field1] = "gaming chips" the result will be "gaming tokens"
if |->[field1] = "gaming pieces" the result will be "gaming pieces"
if |->[field1] = "fish and chips" the result will be "fish and tokens"
Hope this helps someone.
t.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|