Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Repetitive conditions for each column in table tool

rachana19
8 - Asteroid

Hi All,

 

I am using table tool to put around 54 conditions using If - else statements for each column. There are around 26 columns where I need to put these conditions.

As this makes the task very lengthy, is there any way to do this process quickly?

For e.g. Can I use macro or any other way to do this?

 

Unfortunately I cannot share the workflow here.

 

Thanks,

Rachana

4 REPLIES 4
Hannah_Lissaman
11 - Bolide

Hi @rachana19 

 

I assume that you are doing this to apply formatting to your table. 

 

If you are trying to apply the same formatting to the whole table, you can do this using the menus at the bottom of the configuration window:

Hannah_Lissaman_0-1589537315448.png

 

If you need to apply unique formatting to each column or to different groups of columns, then it will depend on what type of formatting you would like to apply. 

 

If you are formatting numbers or adding suffixes to them, it may be easier to do this using one or more Multi-Field Formula Tools before creating your table. If you need to apply a format that can't exist in a number format, e.g. adding a % sign, you can convert to text to achieve this.

 

If you are applying different background colours or other table-specific formats, unfortunately there is not a quick way around this. 

rachana19
8 - Asteroid

Hi Hannah,

 

Thanks a lot for quick reply.

 

I am comparing multiple columns in the same row, if match found applying background color green, if no match found applying background color red.

 

Could you please help with below -

 

1. Can I use Alteryx macro for this purpose?

2. Can I create excel/vba macro and then integrate with Alteryx workflow?

 

Thanks,

Rachana 

Hannah_Lissaman
11 - Bolide

Hi @rachana19 

 

We can't use Excel or VBA macros to affect Alteryx settings, and I can't think of way to do this via Alteryx macro. However, I do have a way to hopefully speed up your process a lot using the XML editor. This method is not automated, but it is a lot more efficient than having to open the 'add rule' dialogue for each individual column.

 

Please be very careful when editing XML - this should be a 'last resort' option, and you should make sure you back up your workflow before trying. 

 

First, create a rule for one column using your usual process.

 

Then open the XML editor as shown here - it will open in a popup window:

Hannah_Lissaman_1-1589539901575.png

 

In the XML code, locate your rule (in the StyleRules section) and copy everything from the opening <Rule> tag to the closing </Rule> tag:

Hannah_Lissaman_2-1589540062731.png

 

You can now paste and edit this code to add more rules. Make sure you paste it after your previous rule and before the closing </StyleRules> tag.

 

To add a new rule, you need to edit the following:

  • Rule Name (needs to be unique)
  • Field (the name of the column it applies to)
  • Formula (the edit the text of the formula to refer to the correct columns)

Here is an example where I applied the same rule to two columns which I wanted to match (so the formula is identical for each).

 

Hannah_Lissaman_3-1589540322912.png

 

You can add as many rules as you want via this method. As an added bonus, the individual rules will still be editable via the usual per-column configuration.

rachana19
8 - Asteroid

Hi Hannah,

 

Thanks a lot for going through my request and providing the best possible solution.

Really appreciate patience and detailed response.

 

Thanks,

Rachana

Labels