We are using a cross tab tool to bring in dynamic values and provide to the end user in a List Box. We want to provide the user with feedback and end the workflow flow if they've chosen more than X number of selections. I was testing with a limit of 2 on the dummy data below. We either have the error message always show up regardless or never show up. Does anyone have any insight?
You have a List Box tool to change the value in the Filter tool, but the Filter tool only has one value in it, so when you select more than one value in the List Box, it tries to pass that to the filter. You also have the Action tool replacing the entire formula expression. But even if you change the value in the Action tool to just Alpha 1, it'll still throw the error because it's trying to replace Alpha 1 with more than one value.
I read your post wrong to begin with. Add an exclamation point before your expression in the Error tool -- !REGEX_CountMatches([#1],"|")>2 -- and it'll pass when you select only one thing from the List Box.
Your regex expression is not written correctly. The pipe character is used by regex so you need to add a backslash to indicate you want to match on a literal "|". Below is how it should be written.
That said, the setup for how your list box tool is getting values may not work in the way you're expecting it to when it's ran as an app. the list box will always show the values based off the metadata it was saved with.
If you want the values in a list box to change based an input, you'll need to go with the chained app route.