cancel
Showing results for 
Search instead for 
Did you mean: 
XenoIcon
Nintex Newbie

Way to remove the square brackets and quotation marks from a multiple choice list?

Jump to solution

Hey there,

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.

Nintex multiple choice issue.jpg

Labels: (2)
Tags (1)
Reply
5 Replies
Nintex Employee
Nintex Employee

Re: Way to remove the square brackets and quotation marks from a multiple choice list?

Jump 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:

CollectionRegex.png

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):

ResultsRegex.png

 

 

Reply
XenoIcon
Nintex Newbie

Re: Way to remove the square brackets and quotation marks from a multiple choice list?

Jump to solution
Hey Burked,
This is perfect! Thank you for putting the time and effort into that detailed response.
Reply
ChetChudasamaTS
Nintex Newbie

Re: Way to remove the square brackets and quotation marks from a multiple choice list?

Jump to solution

@burked 

 

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?

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: Way to remove the square brackets and quotation marks from a multiple choice list?

Jump to solution

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:

 

O365FormReplace.png

 

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: 

 

CalcValueConfig.png

 

When the user interacts with the form, it will look like this:

 

CalcReplaceRuntime.png

Reply
ChetChudasamaTS
Nintex Newbie

Re: Way to remove the square brackets and quotation marks from a multiple choice list?

Jump to solution

Hi @burked,

 

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??

0 Kudos
Reply