Totting Up

I searched - found “Running Totals or a Formula” - damn close issue but no use so far…

Never used variables in Crystal before - after all these 9 years! Can you just tell me WHERE to declare the variables, how to refer to these, make changes and finalise the routine? Seems weird - declare variables in formula fields? I’m used to C++. What is WhileReadingRecords?

I have a big complex query giving rows with left joins, so many NULLS where each row has a CATEGORY field which will be a value in a list which dictates a selling price. There is a quantity in the row too. So I’ve tried different methods of Running Totals, but there don’t seem to be many. I’d use a formula, but have to choose a field to summarize at the same time, which I think would compound the summarisation!

I want Crystal to go through the rows and add to a variable or Running Total where the CATEGORY field shows a specific value. With left joins, seeing categories from different tables. Want to tot up where these categories are seen and added up into a pot…? And put the result in a cross-tab

Thanks
Mike


mikebird (BOB member since 2008-12-27)

Hey,

Depending on whether you select Crystal or Basic syntax variable declaration is (in Basic syntax anyway).

Dim YourVar As Number

To Increment a variable, just add something to it;

YourVar := YourVar + 1

Or conditionally;

If {db field} = ‘Something’ Then YourVar := YourVar + 1 else YourVar

Variables are declared at the top of the formula in the formula text.

‘WhilePrintingRecords’ will force a formula to evaluate in the last of Crystals 3 passes. A running total formula, needs this at the very start of the formula to force the formula to evaluate at the right time.


ABILtd :uk: (BOB member since 2006-02-08)