Format expression issues and color coding issue

Posted:
Sun Mar 18, 2012 8:45 pm
by mager
1. I'm trying to use some format expression and I am having troubles making it work. Here is the first 2/3 parts of it:
- Code: Select all
if ( (this) > 99.5, '99', (format( '{1}{2}', if ( (this) < 9.5, ' ', ''), format_number( (this), 0, false, false) ) )), if( cnt_p_open_opp = 0, ' - ', format_number((this), 0, false, false) )
(RFI example)
If I take one part of it(either of them) - it is working properly. If I try to combined them - it is valid to create but cause an expression error on the HUD(tried it on few different stats). What is the reason for that? And how to fix it?
2. The other 1/3 part is rounding to the nearest 5:
- Code: Select all
if( ((this) > 0.5 AND (this) =< 2.5), '1', if((this) =< 7.5, '5', if((this) =< 12.5, '10', if((this) =< 17.5, 15, if((this) =< 22.5, 20, if((this) =< 27.5, 25, if((this) =< 32.5, 30, if((this) =< 37.5, 35, if((this) =< 42.5, 40, if((this) =< 47.5, 45, if((this) =< 52.5, 50, if((this) =< 57.5, 55, if((this) =< 62.5, 60, if((this) =< 67.5, 65, if((this) =< 72.5, 70, if((this) =< 77.5, 75, if((this) =< 82.5, 80, if((this) =< 87.5, 85, if((this) =< 92.5, 90, if((this) =< 97.5, 95, 99))))))))))))))))))) )
It is valid expression to create but cause an invalid error on the HUD("Invalid operation specified in expression"). Again, What is the reason for that? And how to fix it?
3. I'm trying to create a stat color coded by another stat, and if there are no opportunities for the colored based stat - I want it to be in natural color. With a single condition it is working just fine:
http://oi42.tinypic.com/o69sw3.jpgBut with double condition in one line(using "AND"), it shows it in red(=0) even if there are no opportunities. Here is an example:
http://oi41.tinypic.com/r2rmah.jpgWhat is the reason for that and how can I fix it?
Thanks.
Re: Format expression issues and color coding issue

Posted:
Mon Mar 19, 2012 6:32 am
by WhiteRider
1. You need to write an expression which evaluates to a single value.
Here you have:
if( xxx ), if( yyy )
..and that will not work.
You need to put everything inside one IF statement, or one format expression.
e.g.
if( cnt_p_open_opp = 0, ' - ', if( this > 99, 99.5, format( '{1}{2}', if( this < 9.5, ' ', ''), format_number(this, 0, false, false) ) ) )
2. You need to use <= rather than =< (and >= should you ever need that).
3. You need to check that both numbers are less than 0.5.
What you have there is:
numberA AND numberB < 0.5
You need:
numberA < 0.5 AND numberB < 0.5
Re: Format expression issues and color coding issue

Posted:
Mon Mar 19, 2012 9:59 am
by mager
1&2. I think your solutions has worked. The issue is that I want to combine all the parts into one format expression, and it does not work(it does not round to the nearest 5). My guess is that I need to make it evaluate a single value again. I'm a bit confused on how to make it do all of the the things I want. (Show " - " for no opportunity, make 100 show as 99, add " " if the number is under 9.5 so that the boxes will stay the same size, AND round to the nearest 5)
Here are the latest codes seperated:
- Code: Select all
if( cnt_p_rfi_sb_opp = 0, ' - ', if((this) > 99.5, '99', (format( '{1}{2}', if ( (this) < 9.5, ' ', ''), format_number( (this), 0, false, false)))) )
- Code: Select all
if( (this) < 0.5, '0', if((this) <= 2.5, '1', if((this) <= 7.5, '5', if((this) <= 12.5, '10', if((this) <= 17.5, 15, if((this) <= 22.5, 20, if((this) <= 27.5, 25, if((this) <= 32.5, 30, if((this) <= 37.5, 35, if((this) <= 42.5, 40, if((this) <= 47.5, 45, if((this) <= 52.5, 50, if((this) <= 57.5, 55, if((this) <= 62.5, 60, if((this) <= 67.5, 65, if((this) <= 72.5, 70, if((this) <= 77.5, 75, if((this) <= 82.5, 80, if((this) <= 87.5, 85, if((this) <= 92.5, 90, if((this) <= 97.5, 95, 99)))))))))))))))))))) )
How do I combine them into one single line?
3. You solution has worked for the color codes.
4. It seems like I have a problem with one HUD group that always reset his position. I save the ayout and it is working for some time, and then at some point it just reset to a default place and I have to re-position it. What might be the problem?
Thanks :)
Re: Format expression issues and color coding issue

Posted:
Mon Mar 19, 2012 2:33 pm
by mager
OK, it turns out that it was kinda silly of me. If I use the round the number to the nearest 5 code, I can add the spaces that I want in the proper part and then I do not need the "format" part that adds spaces. It would look like this:
- Code: Select all
if( cnt_p_rfi_sb_opp = 0, ' - ', if( (this) < 0.5, ' 0 ', if((this) <= 2.5, ' 1 ', if((this) <= 7.5, ' 5 ', if((this) <= 12.5, '10', if((this) <= 17.5, '15', if((this) <= 22.5, '20', if((this) <= 27.5, '25', if((this) <= 32.5, '30', if((this) <= 37.5, '35', if((this) <= 42.5, '40', if((this) <= 47.5, '45', if((this) <= 52.5, '50', if((this) <= 57.5, '55', if((this) <= 62.5, '60', if((this) <= 67.5, '65', if((this) <= 72.5, '70', if((this) <= 77.5, '75', if((this) <= 82.5, '80', if((this) <= 87.5, '85', if((this) <= 92.5, '90', if((this) <= 97.5, '95', '99')))))))))))))))))))) ) )
Is that correct?
Anyway, it is valid but not working.
I think that you still haven't fixed the issue where the HUD is displaying the Value Expression rather than the Format Expression. Is that possible? Because I see no other reason for it not to work.
Also, if there is no opportunity the HUD is showing the No Opportunity text I define under 'reporting options'(tried making it nothing, or just one space - it still overwrite the format expression). I'm not sure if that is because the above issue or because the setting under 'reporting option' just overwrite it. Please let me know.
Lastly, I'm still having #4 issue from my last post.
Thanks.
Re: Format expression issues and color coding issue

Posted:
Mon Mar 19, 2012 4:41 pm
by kraada
Try this and let me know if it works better for you:
if( cnt_p_rfi_sb_opp = 0, format(' - '), if( (this) < 0.5, format(' 0 '), if((this) <= 2.5, format(' 1 '), if((this) <= 7.5, format(' 5 '), if((this) <= 12.5, format('10'), if((this) <= 17.5, format('15'), if((this) <= 22.5, format('20'), if((this) <= 27.5, format('25'), if((this) <= 32.5, format('30'), if((this) <= 37.5, format('35'), if((this) <= 42.5, format('40'), if((this) <= 47.5, format('45'), if((this) <= 52.5, format('50'), if((this) <= 57.5, format('55'), if((this) <= 62.5, format('60'), if((this) <= 67.5, format('65'), if((this) <= 72.5, format('70'), if((this) <= 77.5, format('75'), if((this) <= 82.5, format('80'), if((this) <= 87.5, format('85'), if((this) <= 92.5, format('90'), if((this) <= 97.5, format('95'), format('99'))))))))))))))))))))) ) )
Re: Format expression issues and color coding issue

Posted:
Mon Mar 19, 2012 6:33 pm
by mager
It didn't fix it - I still have the same issues...
Re: Format expression issues and color coding issue

Posted:
Tue Mar 20, 2012 4:57 am
by WhiteRider
If the format expression is not being used in the HUD then it won't make any difference what you do there.
Re: Format expression issues and color coding issue

Posted:
Tue Mar 20, 2012 6:07 am
by mager
What reason does it have to not being used? I put it there because I WANT IT to be used... The problem is that it does not.
Re: Format expression issues and color coding issue

Posted:
Tue Mar 20, 2012 2:26 pm
by kraada
I think WhiteRider was emphasizing the conditional - if it's not being used, it won't matter what's there. Obviously we agree it should be used. I was hoping calling format() explicitly would force it to be used though obviously that does not appear to be the case.
I'll see what I can find out on this for you further.
Re: Format expression issues and color coding issue

Posted:
Thu Mar 22, 2012 6:44 pm
by mager
Any chance you found out more about it?
As I previously said, I think the problem might be that the HUD is displaying the Value Expression rather than the Format Expression. It has been an issue in the past with other format expressions and I do not know if you fixed it.