Get Free Trial

String comparison in IF statement ? version 2.8.13

Answered
Thomas Orré asked on July 1, 2021

Does string comparison work in version 2.8.13 ? I’d like to use something like :
 
If (Column1 == ‘Apple’, count(“Column1”), 0)
 
Thanks 

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster July 2, 2021

Hello, Thomas,
 
Thank you for writing to us.
 
Our team would like to kindly explain that comparing string members in the calculated value formula is not supported. This is because, by design, the calculated value functionality was intended for values, not hierarchies.
 
Please let us know if you have any other questions.
 
Kind regards,
Illia

Public
Thomas Orré July 5, 2021

Hello Illia, 
 
Thank you for your answer,
 
Ok, then as a Workaround, I guess I can replace string values by integer, for instance “Present” > 1, “Absent” > 0, “Other” > 2 ?
I tried to test a calculated value formula on numerical values, but I can’t get it to work…
My table contains a column ‘Age’, and some values are ’19’ (image 1 in the attached file), in the floating point number format.
However, I do not manage to count thoses values. I’ve tried the following formula :
if(“Age” == 19, count(“Age”), 0)  => returns “0”  (see image 2, 3, 4 in the attached file)
 
Even if I remove the “Période” parameter as “Rows” (“Lignes” in my language) (see image 5), if(“Age” == 19, count(“Age”), 0)  returns “0” (see image 6).
 
Can you tell me how to be able to count a recurring numerical value ? 
Kind regards
 
Thomas
 
 
 

Attachments:
FlexMonster_img.png

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster July 6, 2021

Hello,
 
We want to confirm that you can replace string values with associated numbers as a workaround.
The issue you are facing can be resolved by setting individual property of the calculated value to true. This parameter defines whether the formula is calculated using raw values or using aggregated values. In your case, raw values should be used. Otherwise, Flexmonster will sum “Age” first, and apply the condition afterward.
 
Here is a JSFiddle for demonstration: https://jsfiddle.net/flexmonster/wr8yhpz1/. You can configure it using UI by selecting “Calculate individual values” option or “Calculer les valeurs individuelles” with localization applied.
 
Please let us know if it helps.
Looking forward to your feedback.
 
Kind regards,
Illia

Please login or Register to Submit Answer