ryanceot Posted April 6, 2022 Share Posted April 6, 2022 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? Example: 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! -Ryan Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted April 6, 2022 Share Posted April 6, 2022 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. Quote Link to comment Share on other sites More sharing options...
ryanceot Posted April 7, 2022 Author Share Posted April 7, 2022 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". Thanks, Ryan Quote Link to comment Share on other sites More sharing options...
MartyrSyx Posted April 8, 2022 Share Posted April 8, 2022 if (Field("PTO").indexOf("A") > -1) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.