Hello
I am trying to achieve the following:
On a calc element i am counting if elements are not empty in order to fill a % of completition of the form. I have everything almost done but now i run in a small problem, i need one field to condition the sum of the %. So its something like this:
What it means is if the field "a" has a value of "2" the count should be done for the fields b,c,d. Then if table___a equals 2 the formula to obtain the % is the counts divided in 24 (since there are 3 more elements to consider). Else divide on 21.
So far with that aproach i get wrong % and even if i dont do the % (just the counts) it still wrong.
Any help is appreciated. Regards.
I am trying to achieve the following:
On a calc element i am counting if elements are not empty in order to fill a % of completition of the form. I have everything almost done but now i run in a small problem, i need one field to condition the sum of the %. So its something like this:
PHP:
if( '{table___a}' != '0' ) $count++;
else if('{table___a}' == '2')
if ( '{table___b}' != '') $count++;
if( '{table___c}' != '') $count++;
if( '{table___d}' != '0000-00-00 00:00:00' ) $count++;
if('{table___a}' == '2') $formula = round((($count / 24) * 100));
else $formula = round((($count / 21) * 100));
return ($formula . '%');
What it means is if the field "a" has a value of "2" the count should be done for the fields b,c,d. Then if table___a equals 2 the formula to obtain the % is the counts divided in 24 (since there are 3 more elements to consider). Else divide on 21.
So far with that aproach i get wrong % and even if i dont do the % (just the counts) it still wrong.
Any help is appreciated. Regards.