Get Free Trial

Conditional formating with more complex conditions

Answered
Albert Beermann asked on August 3, 2022

Hello Everybody
 
A)
I can do this:
“conditions”:[{“measure”:”FAELLIGTAGE”,
“format”:”backgroundColor”:”#F44336″,”fontFamily”:”Arial”,”color”:”#000000″,”fontSize”:”12px”},
“formula”:”#value < 10″}]
I need an example how to do something like:
if(#value < 10) { then background.green}
else if (#value >= 10 && #value < 30 ) {then background.yellow  }
else {background.red}
We just want to visiualize ‘traffic lights’ (green = Ok, yellow = prepare, red = upps)
 
B)
We need formating based on text fields. For example:
If customername like ‘%GmbH%’ && debts > 25000 then …
means: customers with special legal forms need special attention 🙂
 
Any help welcomed
Best regards
Albert
 

3 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster August 4, 2022

Hello, Albert!

Thank you for your questions.

“Traffic light” visualization
Flexmonster supports setting multiple conditions via conditional formatting. In the example which you have described, if-else blocks can be replaced by three separate if statements:

if( #value < 10 ) { then background.green }
if( #value >= 10 && #value < 30 ) {then background.yellow }
if( #value >= 30 ) { then background.red } 

These statements can be represented by placing three condition objects inside the conditions array. Please see the JSFiddle example.

Formatting based on text fields

Conditional formatting allows specifying the exact string member to which the formatting is applied by the combination of member and hierarchy properties. Kindly note that this feature does not support the usage of string filters. Also, it will highlight only the numeric measures on the grid. If you want to highlight the string members, we suggest using the customizeCell() API call.

Please see the example illustrating both the conditional formatting with member and hierarchy properties and the customizeCell usage for highlighting the string member: https://jsfiddle.net/flexmonster/297akfqn/ 

Hope you will find this information helpful. Looking forward to hearing from you.

Best Regards,
Maksym

Public
Albert Beermann August 5, 2022

Hello
 
Working.
Thank you!
Regards 
Albert

Public
Maksym Diachenko Maksym Diachenko Flexmonster August 5, 2022

Hello, Albert!

We are glad to hear that the suggested approaches worked for you.
Feel free to reach out to us if any other questions arise.

Best Regards,
Maksym

Please login or Register to Submit Answer