Jump to content
Sign in to follow this  
overrider

Change Text Color based on Calc & Rounding Output

Recommended Posts

Hello all,

i have a Question regarding the below Calculation. It is a Field where i want to display a Profit in Percent. If the Percent is below a certain Value, i like it to be red. To make this work, i had to define the profit_percent Field as a Text Field, otherwise the results would appear, but only black not color. However, if i make it a Text Field i cannot Round anymore to two Decimals. Does anybody know if i can fix it by using appropriate GetAsText or Number Functions? Only using the Round Function wont work.

 



Case ( 



IsEmpty ( sale ) or 

IsEmpty ( cost ) or 

IsEmpty ( min_buy_break ) or 

IsEmpty ( min_sale_break ) or 

IsEmpty ( sale_cur ) or 

IsEmpty (cost_cur) ; "" ;



Let(

[

profit = profit_amount / cost

profit_bad = GetAsText ( TextColor ( profit ; RGB ( 255 ; 0 ; 0 ) ) );

profit_good = GetAsText ( TextColor ( profit ; RGB ( 10 ; 140 ; 10 ) ) )];



Case(



profit > 20; profit_good & " %" ;  profit_bad & " %"

)

)

)



regards,

Overrider

Share this post


Link to post
Share on other sites

Ugo is right; modifify the profit line to read

profit = Round ( profit_amount / cost ; 2 )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.