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

How to obtain previous year data in an array

Status
Not open for further replies.

JasonKaufman

Programmer
Apr 13, 2006
46
US
I am wanting to create a report that will look at the last 3 months of sales. The data is held in an array.
I want the end user to be able to select the 1st month and the year for that starting month.

My problem is how do I deal with a month selection of either January or February as the previous month(s) will be in a prior year.
I currently have the two formulas below which work well as long as January or February are not selected.

Month1 =
((local stringvar array x;
x:=split({oe_hist_prod.units-shipped}, ";");
tonumber(x[{?Month 1}]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-nrstkd}, ";");
tonumber(x[{?Month 1}]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-rstkd}, ";");
tonumber(x[{?Month 1}]);))

Month2 =
((local stringvar array x;
x:=split({oe_hist_prod.units-shipped}, ";");
tonumber(x[{?Month 1}-1]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-nrstkd}, ";");
tonumber(x[{?Month 1}-1]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-rstkd}, ";");
tonumber(x[{?Month 1}-1]);))

Month3 is similar @ x[{?Month 1}-2]

I am unsure how to incorporate the month & year selection into either the formulas directly or indirectly through other formulas.

Thanks for any help that can be offered.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top