cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Running Total is null when value is not null and formula is true

tlreichard
Discoverer
0 Likes
386

I have a running total for each group of grades in my report that isn't calculating a field for absolutely no reason. It uses a formula to evaluate on a group change (previous lot pallet) and if a global variable n is within a date range:

global datevar n;

(

onfirstrecord or

{@PrevLotPallet} <> previous({@PrevLotPallet})

) and

n in {?Start Date} to {?End Date}

Commenting out the portion of the formula with n in it gets it to populate, but then it's getting a bunch of extra data in other groups (that i DO need to look at which is why i cant just filter it out in the selection). I haven't used global variables in a report before but it's reset to a default value for each group and then evaluated on each record to either update or stay the same, i set up a variable with whileprintingrecords to just show n and it's there at least.

I can't just have it default to null like other questions say, it's not supposed to be null. Any help on why it'd be null even though a formula says it should calculate and the value is definitely there?

I'm working in crystal reports 2020 if that helps.

Accepted Solutions (1)

Accepted Solutions (1)

JWiseman
Active Contributor
0 Likes

Hi Tanner, this could be due to evaluation times in Crystal. With a manual running total, it's best to use 'whileprintingrecords' in order to have the formula evaluate properly down the report. e.g. As a sample running total:

whileprintingrecords;
global numbervar x:= x+ 1;

Other things that affect evaluation times is when a formula calls another formula...this could even be due to the order that formulae are placed on the report canvas when on the same section. In those cases one can use evaluateafter() in formulae in order to set their order. Try using whileprintingrecords, in the formula you posted, to see if that resolves the issue first.

tlreichard
Discoverer
0 Likes

That didn't work for the running total field, but moving it to just a normal formula and making running totals that way did. There's still some differences in my totals but I'm hoping that's just because of the data itself rather than the report. Thanks for your help Jamie!

JWiseman
Active Contributor
0 Likes

Let us know if you find the issues are in fact due to the data...in that case please post the syntax from your formula(s), a screenshot of the values in question and what the expected amount should be and why.

One thing I forgot to mention, is that in the File menu > Report Options there are 2 options for handling Null values...they are not checked by default and can affect formulae based on fields that contain nulls.

Answers (0)