Hi all,
In a table, is it possible to put more than one style rule on a particular field?
In the below example, I have a particular value, with three pipes (|||) in front of it. Any value with this prefix is to be output in the table as a red colour (as below).
I did this using a formula:
LEFT ([Comments],3) = ‘|||’ and then selecting the colour red.
However, I need to then remove the pipes from the beginning of the string so that only the string and the red colour remain (without the three pipes at the beginning).
I’ve tried adding a second rule for the column, using TrimLeft, If statements, etc, and have tried writing something similar into the first rule, however nothing seems to work at all.
So, is it possible to perform more than one rule on the same column within the table tool, so that once Alteryx changes the colour of '|||' prefixed strings to red, it then removes that prefix of '|||'?
Any help at all, would be greatly appreciated.
Many thanks
Ben
Solved! Go to Solution.
@BPA1982 you won't be able to change the data within the Table tool as it only creates reporting elements. The functions you use in the tool are only there for you to be able to make visual changes to the table. My suggestion would be to use a different field to designate your data that has the 3 pipes or parse the pipes out into a different field and use that field as a designation and use a Formula to say if this field has 3 pipes, then color this field.
I attached a sample workflow that uses two functions in the Formula tool. One to parse out the pipes to a new field and one to remove the pipes from the original field. Then in the Table tool, I added an expression that just states, if the new field contains -1 (which marks if the field contains pipes) then color the other field red.
Hi @DanM,
Thank you very much for your reply and the attached workflow. I tried the formula first before the table tool and that seems to do the trick. I was just wondering however, is it possible to do a regex_match so that an entire string would be returned (e.g. "|||The quick brown fox") as opposed to just a single word?
Many thanks
B
@BPA1982 you can do that, but if your data within that field does not match the REGEX match you will end up with nulls where you don't want them. I simplified the workflow so you don't have to deal with that. see attached.
That's great @DanM.
Thank you very much for your help in pointing me in the right direction. It's very much appreciated.
Kind regards,
B
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |