I am attempting to use a List Box to generate a comma-separated list of values that have been selected. That part is easy enough
See example screen shot. As expected, the output of the final node is 'parameter1,parameter3,parameter4'
However -- is there a way to do this in a single Formula expression? (It'd have to involve RegEx, I'm sure.)
My goal is to use the comma-separated list in combination with the Action Tool's "Update Value with Formula" option to directly supply the comma-separated list to another tool in the macro.
Solved! Go to Solution.
Hi @Scott_Snowman,
replace(regex_replace([A], '(\,)*\w*?=False(\,)*', ''), '=True', '')
This formula replaces all the values that equal false using regex, and then replace the '=True' string with a regular replace.
Hope this helps neaten up the workflow!
@lmorrell truly, it should be said that with a long enough RegEx expression and a place to stand, one can move the world. (Or, perhaps at least replace it with something more desirable.)
I definitely need to study more RegEx. Thank you so much!
That being said this looks just slightly off. I get the following with a test string:
parameter1=True,parameter2=True,parameter3=False,parameter4=True
parameter1,parameter2parameter4
The comma before the final parameter always seems to be missing and my attempts to fix it weren't successful.
Any ideas?
Edit: By changing the provided RegEx to the below, I'm left with what I need but a trailing comma at the end if I have any True parameters before any False parameters. That's easily Trimmed away.
\w*?=False(\,)*
So this looks like it should work:
TrimRight(replace(regex_replace([A], '\w*?=False(\,)*', ''), '=True', ''),',')
@lmorrell if my edited solution makes sense, and you would like to adjust your original response to include, I'll gladly mark it as the Solution.
Thank you!!