Dataview block with Numbers & Text
Hi Guys,
I've a formatting issue with a dataview for a accounting report.
In one block, I need to have a percentage resulting from a calculation of 2 other blocks when a condition is fulfilled. Otherwise I need "N/A" to be displayed.
So far, I did the follow in my dataview :
- created 1 algo block for the percentage calculation (I used the nexel Deepest rules as the formula is different according to the row).
- created 1 algo block, that truncates the result obtained in the previous block
- created a last algo block (text), that takes the content of the previous one or writes "N/A".
The problem with this solution is that I lose the formatting of my percentages (i.e. negative between brackets, green for positive percentage, red otherwise).
Does somebody have a better solution so that I can have both my formatted percentages and some text in the same block.
Thanks in advance,
Aurore
Answers
-
Hi,
I think the easiest way would be to use 2 blocks. One with NEXEL and Numeric Type and one (also Nexel) as Text with some string manipulation, like if(a=0;"N/A"; if(a<0;"["&abs(truncate(a;2))&"]";truncate(a;2)) [I used pseudo code, so you might have to cange some stuff in your case).
Then you display the Text Block with an Alert by using the Nexel Block.
Regards
Björn
0 -
Hi Aurore Lb,
since you want to display either text or a number in your "percentage-block", this would have to be displayed as "text", which, on the other hand will not offer any possibility of formatting according to values.
In my opinion you'd need your values to be concatened according to your needs and achieve the colouring by an alarm referencing another block.
Something like
if(<condition>, if(a<0, "("&a&")%", a&"%"), "N/A"))
But, be aware that figures being displayed as text, loose their formatting concerning decimal and thousand separators .
Kind Regards,
Helmut
0 -
HI Björn Reuber and Helmut Heimann,
Thanks a lot for your answers !
So I did what you suggested and got the result I wanted.
I just added one text block with the pseudo code you gave me and then I used an alert on the calculation block for the formatting.
Best regards,
Aurore
0