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

Store record value into stored variable, or hold previous value thru ? 1

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
US
Hi all, using CR 10...

Details of report:

Group #1 Header
details line (usually 2 detail lines, either a "I" or "R" req. mode)
Group #1 Footer (has some calculations)

I have a formula in details (@curmi) that does this:
Code:
if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "I" then
month({ET_REQ_HISTORY_HEADER_MC.Requisition_Date})

It basically takes the MONTH of a req. date if the req. mode = "I". These tables are within the detail. I can either have a "I" value, or a "R" value in the req. mode.

What I need to do is use the "I" mode MONTH (what @curmi returns) in Group #1 Footer for a calculation.

Problem is: I usually have an "I", then a "R" in the detail line. So, for example, in the first detail line ("I") @curmi = 01 , then in the 2nd detail line ("R") = 0 because it doesn't meet the IF statment in the formula.

What can I do to get the first detail line MONTH (01 in the example) for a calculation in the footer?

Can I store it in some variable? Can I hold that MONTH through the details until it changes again by another ("I") detail line?

I hope this makes sense! Thank you for any help provided...
 
Perhaps you should state what the calculation in the footer is.

You can use something like:

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "I" then
1
else
0

The do a sum on that formula.

Please don't make us guess at what you want, take the time to explain what you have and what you want, calculation doesn't mean anything...

-k
 
Youmight try:


groupheader formula:
whileprintingrecords;
numbervar MyMonth:=0

details formula:

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "I" then
whileprintingrecords;
numbervar MyMonth;
MyMonth:=month({ET_REQ_HISTORY_HEADER_MC.Requisition_Date})

Now reference the month in the group footer as the variable:
whileprintingrecords;
numbervar MyMonth;
"Month " & totext(MyMonth,0,"")

-k
 
synapsevampire, The calculation in the footer is this:

Code:
if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "R" and {#RTotal0} = 2 and ({@curmonth} < {@ParaCurMonthS}) then
0
else

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "R" and {#RTotal0} = 2 and ({@curmonth} > {@ParaCurMonthS}) then
Round(datediff("d",({?startdate}), ({?enddate})),0)
//Round(datediff("d",minimum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code}), {?enddate}),0)
else

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "R" and {#RTotal0} = 2 and ({@curmonth} = {@ParaCurMonthS}) then
Round(datediff("d",maximum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code}), {?startdate}),0)
else

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "R" and {#RTotal0} = 1 then
Round(datediff("d",maximum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code}), {?startdate}),0)
else

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "I" and {#RTotal0} = 1 and ({@curmonth} < {@ParaCurMonthS}) then
Round(datediff("d",({?startdate}), ({?enddate})),0)
else

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "I" and {#RTotal0} = 1 then
Round(datediff("d",minimum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code}), {?enddate}),0)
else

Round(datediff("d",minimum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code}), maximum({ET_REQ_HISTORY_HEADER_MC.Requisition_Date},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code})),0)

My apologies.. I didn't realize what the calculation was doing in the footer would affect how I would bring the value from the detail line forward... I'm learning.
 
I think you could use your original formula and reference it in the group footer formula by wrapping it in maximum(), as in:

if {ET_REQ_HISTORY_HEADER_MC.Requisition_Mode} = "R" and {#RTotal0} = 2 and
maximum({@curmonth},{ET_REQ_HISTORY_SUM_JOB_MC.Equipment_Code}) < {@ParaCurMonthS}) then
0
else //etc.

...adding the maximum(formula,groupfield) wherever you reference {@curmonth}.

-LB
 
Thank you lbass.. that solution is working great
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top