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

Adding a field from a subreport

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I have a Main report with a sub report. The sub report only has one field that is created by a formula. I need to add the result of that formula to a field on the main report.

The Sub report generates a 00:04:30 format and the main report something like 00:1:00. The desired result would be to have a field that calculates that to 00:05:30.

Can someone help me accomplish this?

Thank you

Paul
 
What datatype are of each of these fields? Are they time datatypes or string datatypes?

-LB
 
Assuming they represent times, you can create a formula in the subreport like this and place it in the subreport footer:

whileprintingrecords;
stringvar array x := split({table.string},":");
shared numbervar secs := (val(x[1])*3600)+(val(x[2])*60)+val(x[3]);

Then in the main report, in a section below the one where your sub is located, use a formula like this:

whileprintingrecords;
shared numbervar secs;
dateadd("s",secs, datetime(currentdate, time({table.mainstringtime})))

-LB
 
Thank you Lbass, the numbers dont represent a date and time, they are actually HH:MM:SS used to calculate or show how long someone was on a particular phone call.

So the two fields that i need to add are say someones talk time for a particular call was 00:3:30 representing 3 minutes and thirty seconds, and the second value is a "worktime" value of how long they stayed in a certain phone state after the call so if it was 00:1:30 the total time for that call would be 00:5:00.

Paul
 
Lbass, I'm not sure if i can explain this properly but here goes.

the sub report shows a list of "Split names" and the time 00:00:00 that a particular phone state was in that state. So the sub report by itself displays:

Split 1 00:4:30
SPlit 2 00:3:15
split 3 00:10:25

The Main report has data listed the same way but its how long of talk time was for each split for a day, week or month. When i follow your above instructions the totals i get all use the last "split" data. so in my example above every data point on the main report is being calculated with 00:10:25 and not its corresponding data point.

I hope i explained that well enough. I'm sure its something Ive setup wrong but i cant seem to correct it.

Thanks for any help

Paul
 
You need to link the sub and the main report on the the "split" field.

-LB
 
I have them linked on the "split" field. It still only takes the last record and adds that. Is there anything else i should look for? I'm about to call it quits.
 
Are "split1", "split2","split3" instances of the same field that appear in different rows? Or?

Please show the content of the record selection formula in the subreport.

-LB
 
Yes, if i understand correctly, yes they are instances of the same field.

below is the content of record selection for the subreport

{agent_audit_prev1.day}={?date} and
{agent_audit_prev1.activity}=10 and
{work_type1.work_type}=1 and
{splitTable1.Split_Name}={?Split} and
{work_type1.work_name} = "after call work"

I really appreciate your help

Paul
 
How is the main report grouped? In what section is the subreport located? I'm guessing you should be linking on the split name field rather than linking the parameters {?Split}, but not sure without more information.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top