Remember that @if stops running once a true condition is found- so, in the example, if the form is “key Observation” - then it will put in the k and never get to the second condition or else statement.
That’s not it. The column contains some with “K”, some with the number (where there is a field “Grade”), but otherwise it’s empty.
Also if I reverse them it shows the opposite.
If I right-click the rows with an empty value and look at the document’s fields, the first 2 conditions are not true and there is a field “Percentage”, it’s data type is a number and it does have a value.
OK, I just updated the formula to eliminate the possibility of an error converting the number to text so now I see “K”, percentage converted to text and a bunch of empty values (not “0”)
@isavailable checks if a field exists, not if it is empty or not.
If I’m not mistaken, “Percentage” is a field on your form. So all documents will have the field “Percentage”, hence @isavailable(“Percentage”) is always true.
There are several forms in the view. some have the field “Percentage”, others the field “Grade” and then there’s the Key Observation, which has neither. None have both fields and I have verified that by right-clicking on the documents where the column is empty.
Now I altered the formula to this and it is showing “P” even when there is no Percentage field.
There must be something wrong with my logic but I’m missing it…
Removed the @text() and it works.Since the fields Grade and Percentage are numbers I thought mixing them with values like “K” and “0” would cause a problem (and therefore I used the @text()).
You’ve also changed the @isavailable formula from @isavailable(“Percentage”) to @isavailable(Percentage). The way you have it now is correct, so I’m guessing that was your problem.