Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Var's and totals

Status
Not open for further replies.

giggles7840

IS-IT--Management
Mar 8, 2002
219
US
ok i totally stuck and i cant find what i need. can someone point me to a place where i can read on how to create a manual running total using variables. i have see a couple of examples but they arent making any sense.

the reference book that i have looked at talks about var's but doesnt really speak to totalling with it. even crystals manuals dont really mention it, uless im totally missing it somewhere.....

please help pint me in the right direction./
 
Search these forums for one. There alot of examples in this forum alone.

You can also post what you are trying to do and you can get customized help from one of the experts here.

~Brian
 
Perhaps if you post technical information, such as:

Crystal version
Database used
Example data
Expected output

someone can provide the actual code, but as an example:

Crystal does have a Running Total type of field in later versions of Crystal, but I'll assume that it doesn't satisfy your requirements.

To create a Running Total manually you would use the 3 formula method.

Let's say you want the sum of a field if another field has the code "Y" in it

Insert->Field Object->Right click the formulas and select New->Name it

Place something like the following in the details section:

whileprintingrecords;
numbervar MySum;
If {table.codefield} = "Y" then
MySum := MySum+{table.ValueField}
else
MySum

Now at the end of the report display it using

whileprintingrecords;
numbervar MySum

If this is being reset at a group level, create the following 3 formulas:

GroupHeader formula:
whileprintingrecords;
numbervar MySum: = 0;

Details formula:
whileprintingrecords;
numbervar MySum;
If {table.codefield} = "Y" then
MySum := MySum+{table.ValueField}
else
MySum

Group Footer formula to display it:
GroupHeader formula:
whileprintingrecords;
numbervar MySum

-k
 
ok so here are my 3 formulas....

header:
whileprintingrecords;
currencyvar Thursday: = 0;

<error: The remaining text does not seem to be part of the formula>

details:

whileprintingrecords;
currencyvar Thursday;
If dayofweek({Orders.Order Date}) = 5 then
Thursday := Thursday+{Orders.Order Amount}
else
Thursday

Footer:
whileprintingrecords;
currencyvar Thursday

When i try to run it i get a message that says, a summary has been specified on a non recurring field. Details: @<the above detail fomula>
 
Your header formula is erroring because you have a space between the colon and the equals sign. There should not be a space. Does that help at all?

~Brian
 
yup! now all i hve to do is figure out what this all means. :) thanks guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top