I have been trying to write multiple choice fields to a generated document and I just wanted to know if there was a clean way of using regular expression or any other recommended action to remove the square brackets and quotation marks?
I have attached what the output from the multiple choice option looks like in the document.
Solved! Go to Solution.
The multiple choice action is going to function as a collection, so it will output the information in this format. The quickest way to do this will be using a Regex Replace action. One note, you will need to create an empty text variable for the replacement text (go to variables, create variable and leave default value for this variable blank).
From there you will configure the action like below:
The 'Input Text' will be the choice control.
The pattern will be formatted like below:
The replacement text will be the empty variable I created (named blank)
The 'Store Results in' will be a separate text variable that can then be used in your workflow.
Here is the output from my log to instance details (showing pre-regex and post-regex):
Is there a way of doing this in Nintex Forms for Office 365 using replace and possibly adding a line break instead of the comma?
Hi @ChetChudasamaTS ,
This is definitely possible. I configured my form with a Choice Control (multiple-selection), provided the control with the name Multi Choice, along with a calculated value control:
I configured the calculated value control with the formula below (replace MULTI-SELECT_NAMED_CONTROL with the named control reference of your choice control):
replace(replace(MULTI-SELECT_NAMED_CONTROL, "(\[)|(\])", ""), ",", "<p>")
I also configured the calculated value control to resize at runtime so it will expand as we have more selections. It's configured like below:
When the user interacts with the form, it will look like this:
Thanks for all your help so far, I got a further question regarding the formula please, Is there a way to only return the first value for the array?
I have a repeating table of destination cities and use the formula
replace(replace(parseLookup(CityField), "(\[)|(\])", ""), ",", "; ")
to return for example "London; New York; Geneva:
Now how do I get it to only return London in a separate calculated field - is there a way to replace everything after and including the first semicolon; so the output would be just London??