Column formula - @If and @text

I need a second pair of eyes.

I have this column formula, which will display “K” or the text conversion of Grade, but not Percentage or “0”

If I reverse the order of Grade and Percentage in the formula it will show Percentage but not Grade.

@If( Form=“Key Observation”; “K”;

@IsAvailable(“Grade”); @Text(Grade; “F,2”);

@IsAvailable(“Percentage”); @Text(Percentage; “F,2”);

“0”)

Subject: Column formula - @If and @text

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.

Subject: RE: Column formula - @If and @text

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”)

@If( Form=“Key Observation”; “K”;

@IsAvailable(“Percentage”); @Text(Percentage; “F,2”);“0”)

Subject: RE: Column formula - @If and @text

@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.

Try:

percTxt:=@Text(Percentage; “F,2”);

@If( Form=“Key Observation”; “K”;

percTxt!=“”; percTxt;“0”)

Subject: RE: Column formula - @If and @text

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…

@If( Form=“Key Observation”; “K”;

@IsAvailable(“Percentage”); “P”;

@IsAvailable(“Grade”); @Text(Grade; “F,2”);“0”)

Subject: Column formula - @If and @text

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()).

@If( Form=“Key Observation”; “K”;

@IsAvailable(Grade); Grade;

@IsAvailable(Percentage); Percentage;

“0”)

I still find this kind of odd though…

Subject: RE: Column formula - @If and @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.

Subject: RE: Column formula - @If and @text

Thanks… that was it no doubt.

I guess it took a third set of eyes :slight_smile: