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

I think I need to use variables?

Status
Not open for further replies.

BigC72

MIS
Oct 15, 2004
69
US
I am using CR XI to query a DB2 database. Currently I have two tables pulled into the report.

1) DR_PROD_HISTORY
2) SERVICE_CODE

These tables are linked via inner join between these three fields 1) ORG_CODE 2)PROCEDURE_CODE and 3)PROCEDURE_MOD. I have three groups set up currently in the report.

The first group is on DRPRODHISTORY.monthend_date, the second grouping is by procedure code and the third grouping is from the Service Code table. This group is based on a formula whereby different components are displayed as Global, Technical and Professional. The Technical and Professional Component fees comprise the Global fee.

Essentially what I need to do is to create a percentage by diving the global component into the techical component fee and with that figure what amount of the global component dollar value goes to the technical component aspect. I've created two formulas to identify both the global and technical components which look like this:

if GroupName ({@components}) = "Global Component" then {SERVICE_CODE.STANDARD_AMT} and

if GroupName ({@components}) = "Technical Component" then {SERVICE_CODE.STANDARD_AMT}

with these I've attempted to create a variable to place in group footer number three that looks like this:

whileprintingrecords;
numbervar tech_percent := ({@global} / {@tech}) * {@net_charges}

I place this in GF3 and when I run the report I get a division by zero error. The formula picks up the global value and the net charges value but will not pick up the tech value or it's result is zero which prompts the error.

Obviously I'm on the wrong track somewhere I just can't figure out where. I'm feel as though using a variable is the way to accomplish what I need but apparently I'm going about it in the wrong manner.

Thanks in advance for any help.....
 
Okay well let me ask the question differently than. If I have a subreport grouped by procedure code how can I find the percent value of dividing the Global Component value into the Technical Component value? The only way to differentiate between the two is by the modifier field. Globals are "" or empty and Technical is "TC" I can then use this as a subreport and place it into the main report..
 
I can't really follow this, but to address the division by zero problem, use a formula like:

if {@tech} <> 0 then
({@global} / {@tech}) * {@net_charges}

-LB
 
Not sure how they handle this here but Admin can remove this thread...
 
If you have found the solution, please post. Otherwise, why would you want to remove the thread?

-LB
 
No solution found I'm just going back to the drawing board with it. If someone see's value in leaving the post feel free.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top