CALCANALYSIS (Report Header2)
Whileprintingrecords;
Numbervar justabove;
Stringvar analysis;
If {field1} – {field2} >= just above then analysis:= “just below average”
Note: (The mathematical calculation of the two fields is 0.1)
When DISPLAYANALYSIS is used in the report it returns nothing.
Is this something to do with rounding? Or using numbvar to store 0.1 as it works with other numbers such as 1.5 (if I change justabove:= 0.1 to justabove:= 0.5 and update the database fields to match)
Please help, I am sure I must be doing something daft.
FWIW, I did a couple of quick tests and your formulas seem to work fine here. i wouldn't really expect precision to be a problem, unless your values are unusually large, or have a lot of decimal places.
I'd try changing the last line in the second formula to just
{field1} - {field2}
and see what you get.
James
0
Be seen. Boost your question’s priority for more expert views and faster solutions
Or, as I suggested before, just change the last line in your second formula to {field1} - {field2}. The point of that is to see the actual value that CR is getting from that calculation. Of course the assumption there is that the result of that formula is visible on the report (not in a suppressed field or section). And you may need/want to change the field format to show more decimal places, to get a more precise view of the value.
When we use the following integer formula it returns the data correctly which is great:
if int({KS1_All.Writing APS}*10) - int({National_All.Writing APS}*10) >= justabove then holding_Writing:= "just above"
However, now the integer formula is working when mutiplying by 10, I would just like to to confirm if the precision problem identified would affect any of the following variables or is it just where it is 0.1 and -0.1?
Perhaps it would be worth testing a variation of this. Set justabove to 1 and do..
If int({field1}*10) – int({field2}*10) >= justabove then analysis:= “just below average”