Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Mark rows with negative values of Table tool Output within parenthesis and red color

SrinivasanSugumaran
8 - Asteroid

Hi Team,

 

I have an output (table tool) which has close to 30 rows & 25 cols.

I have certain values as -ve. (eg: -357; -1784; -1922 etc).. i want the output as (357); (1784); (1922)

The negative numbers are distributed across rows & columns without any pattern.

Is there a way i can use a formula in Table tool such that all the numbers in the Table output which are negative can be updated within parathesis and Red colour.

 

Thanks in advance for help

2 REPLIES 2
DataNath
17 - Castor
17 - Castor

Hey @SrinivasanSugumaran, the first step of this process would be to handle the bracketing of negative values. Unfortunately, when displaying your data this way, we can't just apply a different format and keep things numeric. In Alteryx, we have to sacrifice the data type and make the field into a string and so the best way to handle multiple fields at once (as you mention you have 25), is to use a Multi-Field Formula tool. Within this tool, we can change the data type of the results as well which is perfect:

 

Before:

DataNath_0-1667132065421.png

 

After:

DataNath_1-1667132084379.png

 

Now that we've handled the data itself, we can move to the Table tool. Here we can use a little trick to set up a rule which will universally apply to all fields, rather than having to manually create a column rule for each of your 25. If you drag a Table tool onto the canvas without connecting it to an input, you'll be able to build a rule for 'Dynamic or Unknown Fields', like so:

 

DataNath_4-1667132421636.png

 

Under 'Per Column Configuration' we just select Dynamic or Unknown Fields, click 'Column Rules' and apply the following formula expression:

 

StartsWith([_CurrentField_],'(')

 

And then select Text Color (which will be applied when the expression above is true), red.

 

After this is set up, we just connect the Multi-Field Formula tool and the rule is applied to all fields as they were previously Unknown:

 

DataNath_5-1667132525521.png

 

This also means that in future, if you add more columns, the rule will automatically be applied.

 

Hope this helps get you started on the right track. Off the top of my head I can't think of how to build a universal column rule in one but 

grazitti_sapna
17 - Castor

Hi @SrinivasanSugumaran , You need to first replace - with brackets and then apply the column rule in table as below to get your desired output. Please find the workflow to get your desired output.

 

grazitti_sapna_0-1667194492911.png

 

Sapna Gupta
Labels