Report Date Ranges

Cannikin
Member Posts: 72
Hello! I just found you guys and am hoping you can help me out. Our company purchased Navision 6 months and are still making all kinds of changes. I kind of got volunteered to be the "expert" as far as making forms and such. My background is in web design and development (SQL Server & ColdFusion along with JavaScript and Flash's ActionScript), so C/SIDE is a little foreign to me, but I'm warming up to it.
I'm familiar with programming concepts and techniques, I'm just not fluent in the syntax yet.
We have a report right now (it may be a default one included with the product) called "Sales History" and it's report # 10157. For some reason it only shows 8 "units" worth of data (in our case units = months) and we'd like to show the past year.
I can't for the life of me find where in the code that everything is limited to 8. I can find the loop that goes through each month and gets sales totals, quantities, etc., but not anything that actually says "never go past 8."
I tried cheating and just adding columns for 9-12 and making the appropriate changes to the arrays that are being used, but I get an error saying "the indexing 10 in the array is outside of the permitted range."
Any help would be greatly appreciated!
Thanks,
Rob

We have a report right now (it may be a default one included with the product) called "Sales History" and it's report # 10157. For some reason it only shows 8 "units" worth of data (in our case units = months) and we'd like to show the past year.
I can't for the life of me find where in the code that everything is limited to 8. I can find the loop that goes through each month and gets sales totals, quantities, etc., but not anything that actually says "never go past 8."
I tried cheating and just adding columns for 9-12 and making the appropriate changes to the arrays that are being used, but I get an error saying "the indexing 10 in the array is outside of the permitted range."
Any help would be greatly appreciated!
Thanks,
Rob
0
Comments
-
Hi Rob
From the error message it seems you need to check the size of the array...increase it to accomodate your req.0 -
Hi arun, thanks for the reply! Where can I change the length of an array at?
I can't figure out how C/AL handles Arrays ... there's nothing in the help about actually creating an array, just a couple functions for working with them. I see tons of ARRAYLEN() checking going on in the code, but I never see anything being assigned to an array or a length being assigned! There are only 2 main chunks of code in the Report:
In the "Item" DataItem:PrintLine := FALSE; CLEAR(QuantitySold); CLEAR("$Sold"); CLEAR("Profit%"); CLEAR(QuantitySoldPRYR); CALCFIELDS("Bill of Materials"); FOR i := 1 TO ARRAYLEN(QuantitySold) DO BEGIN SETRANGE("Date Filter",DateRange[i],DateRange[i + 1] - 1); CALCFIELDS("Sales (Qty.)","Sales (LCY)", "COGS (LCY)"); IF "Sales (Qty.)" <> 0 THEN BEGIN QuantitySold[i] := "Sales (Qty.)"; "$Sold"[i] := "Sales (LCY)"; Profit := "Sales (LCY)" - "COGS (LCY)"; IF "Sales (LCY)" <> 0 THEN BEGIN "Profit%"[i] := ROUND(Profit / "Sales (LCY)" * 100,0.1); PrintLine := TRUE; END ELSE "Profit%"[i] := 0; SETRANGE("Date Filter",PriorYRMin[i],PriorYRMax[i]); CALCFIELDS("Sales (Qty.)"); QuantitySoldPRYR[i] := "Sales (Qty.)"; END; END; IF (NOT PrintLine) AND (OnlyItemsWithSales) THEN CurrReport.SKIP;
And then in a blank entry in the DataItem:CompanyInformation.GET; ItemFilter := Item.GETFILTERS; FOR i := 2 TO ARRAYLEN(DateRange) DO DateRange[i] := CALCDATE(TimeDivision, DateRange[i - 1]); FOR i := 1 TO ARRAYLEN(PriorYRMin) DO BEGIN PriorYRMin[i] := CALCDATE('-1Y',DateRange[i]); PriorYRMax[i] := CALCDATE('-1Y',DateRange[i + 1]) - 1; END;
It looks like everything depends on the value of QuantitySold, however nothing is ever assigned to it! It gets CLEAR()'d and then immediately used again without anything happening in between. I have no idea what's going on.0 -
you said your company has it for 6 months. Your not going to get any older info.
- Anyway I have 8 columns too - it looks like it was basically set up that way because that is all the columns that will fit on the page.
If you select the options tab you can change the length of period to 2M
this will cover a whole year0 -
Cannikin wrote:Hi arun, thanks for the reply! Where can I change the length of an array at?
I can't figure out how C/AL handles Arrays ... there's nothing in the help about actually creating an array, just a couple functions for working with them. I see tons of ARRAYLEN() checking going on in the code, but I never see anything being assigned to an array or a length being assigned! There are only 2 main chunks of code in the Report:
To Create or Amend an array you need to find the Global/Local Variable
click on it's properties and set the Dimensions property to the number you want in the array.Answer the question and wait for the answer.0 -
Hi Rob
I believe the report should suffice your req. with the period option as suggested by savatage... customization warrants a closer look...u have to change the sections also to accomodate the extra col. u want...
for ur array probs. u may increase the size by going to global/local variables and increasing the dimension at its properties..0 -
Thanks for the replies guys!
The customization is no problem, I've already got it in Landscape and have more than enough room for the extra columns. But they still want the report broken down per month, not per 2 months.
There aren't any arrays in the Global/Locals variable list, that's what's got me stumped! I have no idea where this array is coming from. Unless one of these is an array and I just don't know it?0 -
Hi
If you go into the Global Variable list and click on each line, whilst on that line click on the Properties icon on the toolbar or key in Shift+F4, you will then see a list of three properties, the second one Dimensions is the number of dimensions in the array.
The arrays mentioned in the code you posted are
PriorYRMin
PriorYRMax
QuantitySold
$Sold
Profit%
QuantitySoldPRYR
DateRange
I can not do a screen dump as you have because the report you are using is a US localised object.
I hope this helps point you in the right directionAnswer the question and wait for the answer.0 -
Holy cow it worked!! How did you know those were Arrays? I didn't even know that variables had associated properties like that.
Thanks for the help everyone!0 -
Actualy, you don't now that some variable is ARRAY. You make it as ARRAY if you put some value in Dimensions (in Variable Properties).0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions