Quote:
Originally Posted by Metaxil
That worked (with a modification and a fix). You forgot to put #review as '#review' (easily fixed) and I added a format_number at the beginning so I didn't have a 6 decimal answer.
The modified formula for anyone else interested
Code:
program:format_number(
r = test(field('#chapters'),ifempty(field('#reviews'),'0'),'0');
c = ifempty(field('#chapters'),'1');ans = divide(r,c);
cmp(ans,0,'','',ans),"{0:5.1f}")
I removed the comments, as they are explained above, for anyone interested. eschwartz, I appreciate your help.
|
I am astounded that this template works with assignment statements as parameters for the format_number function. The parser isn't supposed to let that through. I won't fix the "bug" though.
As the language was designed and as eschwartz said, your template should be
Code:
program:
r = test(field('#chapters'),ifempty(field('#reviews'),'0'),'0');
c = ifempty(field('#chapters'),'1');ans = divide(r,c);
format_number(cmp(ans,0,'','',ans),"{0:5.1f}")