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

Shared Variable Question

Status
Not open for further replies.

MiagiSan

IS-IT--Management
Aug 1, 2005
51
CA
Hi There,

I have read through quite a few posts on this however I seem to be missing something.

I am using CRX with an SQL database in my main report and I am linking to a subreport which is actually an Access Database.

The Main Report is grouped by:

{person.name}

and at each group level there is a formula called: "Estimated Work ratio" which is ({project.time}/@workdays)*100 to give my ratio.

This calculation is working fine however for employee sick time or vacation will affect this work ratio so a "Time Off" Access database was created... Don't ask :)

The access Database has the following tables:

{person.name) //this is linked to the SQL {person.name}
(missedtime.time)

What I want to do is introduce "missed time" into my "Estimated work ratio" calculation. ((Project time/(@workdays-{missedtime.time}))*100

My Main Report Group Footer 1 has

Whileprintingrecords;
shared numbervar X;

The Subreport Report Footer a has

WhilePrintingRecords;
Shared NumberVar X :=Sum(Missed Time})

If I do not surpress Group Footer 1 on the main report, I see the correct missed time number grouped by {person.name} however when I try to enter this variable into the "Estimated work Ratio" formula I get the error:
"A summary has been specified on a non-recurring field"

Any help would be appreciated...I hope this is enough detail.

Thanks
R







 
Yes, that makes sense,it should error, it isn't arecurring value at the detaillevel, which is what those aggregate functions are designed for..

You'll need to usevariables todothe summing.

Where is the subreport in the emain report?

WHere do you want the output?

Posting can be much simplerif you addressthe facts:

I have a subreport in the <?> section of the main repoirt, and need to have the output in th <?> section of the main report use a formulawhich uses the subreport variable and the main report data to do <?>

Straight forward,describing what you have and what you need.

You did an OK job at what you have, except where the subreport is, which is key.

Then thismakesno sense:

"If I do not surpress Group Footer 1 on the main report, I see the correct missed time number grouped by {person.name} however when I try to enter this variable into the "Estimated work Ratio" formula I get the error:"

If Group 1 is where the subreport is, then you cannot suppress it, subreports won't run if they're in suppressed sections.

Try posting wherethe subreport is, and in what section youneed to provide results fromit in th main report.

-k
 
You need to also post the formula you are using in the main report which references the shared variable. Note that if you are then trying to summarize this calculation across records, you need to use variables that accumulate the results, not the sum() function.

-LB
 
Thank you both,

The SubReport is located in Group Header1 in the main report.

I want my output to be:

Person Est. Work Ratio

Person1 95%
Person2 88%
Person3 99%

(Grouped by Person Name)

The main report works this way now except the Est. Work Ratio formula is not taking "Missed time" into consideration.

The Main report formula that references the Shared Variable (Located in Group Footer 1)is as follows:

Whileprintingrecords;
shared numbervar X;


The Subreport Report Shared Variable (Located in Report Footer A) has

WhilePrintingRecords;
Shared NumberVar X :=Sum(Missed Time})

I want a Sum of the Missed time for each person in my Est. Work Ratio Formula; is this where I am going wrong?


This is my "Est. Work Ratio" formula (located in GH1)

((Project time/(@workdays-{missedtime.time}))*100

Thanks again, I hope this helps








 
If you want your calculation in the group header, it will have to be in GH_b, with your sub in GH_a. Then your formula should look something like:

WhilePrintingRecords;
Shared NumberVar X;
Project time %({@workdays}- X)

-LB
 
Thank you Lbass,

I am almost there.

My original Est Work Ratio calculation was ({project.time}/@workdays)*100 and to get the correct ratio, I did a sum of this formula at the group level. (By person)

As I can not insert a summary on this shared variable, the {project.time}information is not showing up correctly so I tried this one.

WhilePrintingRecords;
Shared NumberVar X;
sum(Project time) %({@workdays}- X)

This performs a sum of all project hours for all people even though the variable is located in GH1b.

Basically what I want is a sum of the {project.time} for each person in my Est Work Ratio Calculation.

Thank you very much for your help!
R
 
Got it working!!

Thank you for the help everyone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top