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

formula for selection of months/year where it rolls from one year to next

Status
Not open for further replies.

JasonKaufman

Programmer
Apr 13, 2006
46
US
I am using CR Developer, version 11

Sales info is in monthly buckets of an array: 0;0;0;0;0;0;1203;72;99;96;75;111;0
The Year is a selectable field by itself

The idea is to have a report where the end user can choose a month number. This selection would then pull the sales data for that month and the next three months of the previous year.
My problem is how to write the formula for when the month selected is either 10,11,or 12 so that it would roll to the next year and months 1,2 and/or 3.

current formula is:
(local stringvar array x;
x:=split({oe_hist_prod.units-shipped}, ";");
tonumber(x[{?Month-Start}]);)
+
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-rstkd}, ";");
tonumber(x[{?Month-Start}]);)
+
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-nrstkd}, ";");
tonumber(x[{?Month-Start}]);)



The 2nd half of the report would take the current year's open PO quantity for the same months selected for sales.
The PO Date is like: mm/dd/year.
So would also need to be able to have that roll over to the future year if month selected is 10,11, or 12.

Thanks for any help provided.
 
Hi

DateSerial(Year(SelectedDate)-1,Month(SelectedDate),1)

Thru

DateSerial(Year(SelectedDate)-1,Month(SelectedDate)+4,0)

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
thanks for the help!

after playing around with it some, I've been able to have it do what I intended.

Purchase Order formula where ?Date is supplied by user
if isnull({po_trailer.sched-delivery-date}) then 0
else
if {po_trailer.sched-delivery-date} in {?Date} to DateSerial(Year({?Date}),Month({?Date})+1,0)
then
({po_trailer.qty-ordered}-{po_trailer.qty-received})*{um_rates.conversion-factor}
else
0

Sales formula for 2nd month
(local stringvar array x;
x:=split({oe_hist_prod.units-shipped}, ";");
tonumber(x[Month({?Date})+1]);)
+
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-rstkd}, ";");
tonumber(x[Month({?Date})+1]);)
+
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-nrstkd}, ";");
tonumber(x[Month({?Date})+1]);)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top