Message Boards Message Boards


Checking if Variables contain a certain string

Is it possible to use the "contains" option for variables as opposed to text input boxes?

I would like to store the text input string on one page and do some analysis on another (to show a tick box on a results page), but the contains option doesn't seem to be available.
(An example would be a variable called Test with a string of text "long text string (about 200 characters) containing the word Since" and searching for whether the Test variable contains the word Since to give a true or false value - showing a tick or a cross on a feedback page)

There is an option under Advanced / Text but this has a connector with both "Contains" and "Piece", and I am not too sure what the "Piece" bit means and can't find any reference to it in the help materials.

I know that an alternative would be to do the analysis on the original text input screen (and allocate variables at that stage), so that is my fallback option if we can't get it to work.

Any help would be greatly appreciated.

0 (0 Votes)

RE: Checking if Variables contain a certain string
variables text
9/3/19 4:29 PM as a reply to Stephen Medway.
Hi Stephen,

Yes, it's possible to check if the variable contains a piece of text. You're very close - using the "contains" action block, you just need to use your variable for the "text" parameter, and use the text you want to look for in the "piece" parameter. This screen shot shows a couple examples.

Let us know if that addresses your need.

0 (0 Votes)

RE: Checking if Variables contain a certain string
9/6/19 8:35 AM as a reply to Rob Penn.
Thanks Rob, I will give that a go

0 (0 Votes)