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

inserting "fake data row" when needed for calculations

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
US
Using CR 10, MS SQL DB

Group Header #1 - grouping by a JOB number
Group Header #2 - grouping by a EQUIPMENT number
Details - Will either have 1 row, or 2 rows.

1 row could be an ISSUE on X Date
2 rows could be an ISSUE on X Date, and RETURN on X Date.

Group Footer #2 - I am calculating the number of days it was used on the JOB (if there are 2 rows).

I use this formula
Code:
datediff("d",minimum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_DETAIL_MC.Equipment_Code}), maximum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_DETAIL_MC.Equipment_Code}))

I calculate a "rental charge" using code
Code:
{@days} * ({TM_EQUIPMENT_BILL_RATES_MC.Regular_Bill_Rate_List5} * {@blah})

I run the report by 2 date parameters.

** My question is.. when the DETAIL only has 1 row (being the ISSUE) it obviously does not calculate a NUMBER OF DAYS. I want to be able to somehow use the current date of when the report is ran so I CAN calculate it.

Like creating a "fake" RETURN row in detail or something when there are not 2 rows in detail??? I'm not sure if I'm looking at this the wrong way.... Make sense???
 
I'm playing around with using this code maybe?

Code:
whileprintingrecords;

if {@days} <> 0 then

{@days} * ({TM_EQUIPMENT_BILL_RATES_MC.Regular_Bill_Rate_List5} * {@blah})

else if {@days} = 0 then

(datediff("d",minimum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_DETAIL_MC.Equipment_Code}), CurrentDate)) * ({TM_EQUIPMENT_BILL_RATES_MC.Regular_Bill_Rate_List5} * {@blah})
 
Disregard this thread. I am going a different route.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top