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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save data in variable

Status
Not open for further replies.

emax6

MIS
Dec 7, 2005
58
0
0
US
In my report I have a value that is repeated over and over. To avoid to totalize this value I would like to save it the first time in a variable that I can use in my report.
For example a person work 8 hours a day, and this value is attached to a mutitude of small jobs done during that day.

When I run my report these 8 hours are cumulated and give me a sum f 32 hours if there is 4 jobs.

How can I totalize the number of job(this I do)for each person , and keep the total number of hours to 8 (instead of 32 hours)
Thanks

I am using Crystal Xi
 
I suggest posting example data AND expected output.

You might be able to add a group by the person, and use a maximum({table,hours},{table.person}) for the hours, and a count({table.job.table.person}) to get these results, hard to know from this descriprion.

-k
 
I just put in an excel file what I am looking to accomplish:


Person 1 **15** 9500 HHH
01/01/03 2 5000 2
01/02/03 5 1000 7
01/03/02 5 3000 12
01/04/03 3 500 15
Person 2
etc...

If I was going to have the detail before the results, I would be fine. My problem is that my totals need to before the details.

The column HHH that I cannot see in the printout calculate the total to give me a total of 15 for this person.

My big problem is to have the **15** showing close to the 'Person1', since this number is only known at the end of the process. My report is fine and give me everything, the only problem I have is this **15**
Hope I am explaining it right.
 
You could go to database->database expert->your datasource->add command and enter something like:

Select count(table.`personID`) as cnttasks, table.`personID`, table.`date`
From `table` table
Group by table.`personID`,table.`date`

Link the command to your main table on {table.personID} and on {table.date}, using the corresponding fields. Be sure to right click on the join->link options and check "Enforce both".

Then in the main report, create a formula {@taskshare}:

{table.dailyhours}/{command.cnttasks}

Then you can insert a sum on {@taskshare} and drag it into the group header. This basically will divide the hours placed in the detail section by the number of times they occur there, so that a sum of them will give you the correct value for the group header.

-LB
 
A shame you wouldn't post the example data and the expected output as requested, rather than just the expected output, you show us your end point, but not the start.

Hopefully LB's suggestion will take care of this.

-k
 
Hi:
For lbass: I was going to do what you suggest. a solution you gave me previously and i am using very often. But I figure that this case was different.


For synapsevampire: Unfortunately, I just have in hand the report saved with a sample data and I only make an assumption of how it look in the table. For this I will have to wait next week

But, thanks to both of you, I will try lbass solution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top