Jump to content

Contains Command

Recommended Posts

I'm given fields with multiple characters where each character is used to "turn on" content within a rule. The order of the characters is random. How do I write a rule to tell FusionPro to look for a certain character within a string, ignore all other characters, and the order of the characters?



Field Name = Optional

Field String 1 = AXYD

Field String 2 = DYXA


If X is in string show content 1.

If Y is in string show content 4.


I'm already using rules that show content based on an exact string match and am looking for the flexibility to show content based on contains vs. an exact match.


Thank you for any assistance you can provide!



Link to comment
Share on other sites

if (Field("FieldName").indexOf("AAAA") > -1)


This returns the index of "AAAA" within the given string starting with 0.

For instance if your string is "zzzAAAAzzz" it would return 3.

If your string is "zzzBBBBzzz" it would return -1 because the search string is not found.

So, if it returns greater than -1, then you have a match.

Link to comment
Share on other sites

Hi Thomas,


Thank you for the response. I'm not sure my question is clear.


I need FusionPro to look at a field that will contain multiple characters in random order. Then tell FusisionPro to show content when a field contains a specific character regardless of where it is in the string.


Example: If field "PTO" contains "A" display "Lakeland, FL".


Strings in PTO could be "124Abd3", "A3429", or just simply "A".




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...