We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

How to check value is empty

Answered
Jaffrezic asked on June 11, 2018

Hi
I would like to display 'N/A' if the price is empty (not value 0)
see value for red :
https://jsfiddle.net/6a0r3h2n/
 
Thanks
Franck

8 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster June 12, 2018

Hello Jaffrezic,
Thank you for your question. Please find the following jsfiddle example: https://jsfiddle.net/flexmonster/6a0r3h2n/14/.
Let us know if it works for you.
Regards,
Dmytro.
 

Public
Jaffrezic June 12, 2018

Hi Dmytro
Thanks for your answer, but it doesn't work form me.
I would like  :
for Blue Total Sum Price  = 0 and test = 0
for Red Total sum Price = N/A and test = N/A
See : https://jsfiddle.net/ygc02we5/
See attach files is expected result.
Regards
Franck

Attachments:
Expectedresult.png

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster June 12, 2018

Hello Jaffrezic,
Thank you for your feedback. Please have a look at the following workaround: https://jsfiddle.net/flexmonster/ygc02we5/7/.
Let us know if the suggested approach works fine for you.
Regards,
Dmytro

Public
Jaffrezic June 13, 2018

Hi Dmytro
Thank for your answer, but it doesn't work because if the price is equal to -1 it display N/A
See Total sum for yellow it display N/A it should display value -1 : 
https://jsfiddle.net/80e5r39p/
Regards
Franck

Public
Ian Sadovy Ian Sadovy Flexmonster June 14, 2018

Hello Jaffrezic,
 
Thank you for the answer.
Here is an improved version: http://jsfiddle.net/flexmonster/uacsn8q9/
We understand that it is kind of workaround and will add this case to our backlog (to think about a better solution).
Also, you can change magic `-1` value with something different to avoid collisions.
Hope it helps.
 
Regards,
Ian

Public
Jaffrezic June 18, 2018

Hi Ian
Thank you for your answer, but it's not a good solution, because I can not know which unique name.
The best solution would be to be able to differentiate the value 0 from the value null
Regards
Franck

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster June 19, 2018

Hello Franck,
Thank you for your feedback. Our component does differentiate when the raw data has either 0 or null values. However, the behavior is a little bit different when it comes to the custom calculated measures. If some field of the formula has the null value the component will use 0 instead of it for the calculations. Pivot table in Excel works the same way when it comes to the calculated values. Therefore, it is the default behavior of our component. At the same time, if you need the calculated value to be null when some field of the formula is null, we will be ready to implement this approach for you as our customer.
Please let us know if there is anything else we can help you with.
Regards,
Dmytro

Public
Ian Sadovy Ian Sadovy Flexmonster September 27, 2018

Hello Franck,
 
We are glad to inform you that we have added a new property calculateNaN to the calculated values and now you can easily check that the value is empty: http://jsfiddle.net/flexmonster/uacsn8q9/20/ (see line 30).
Hope it helps.
 
Regards,
Ian

Please login or Register to Submit Answer