Array Report

madm
Member Posts: 92
I am trying to create a report which shows 3 periods of consumption. The period is determined by the user.
I have looked at some reports to get an idea of how to do this, and came up with the following :
2 dataitems : item and item ledger entry : i have linked, and put filters on as required. ON the item ledger entry i have put the following :
When for example the user puts ending date = 20/02/07 the report runs ok, but the entries for 20/02/07 are not included in the totals. In the code I see there is "posting date" < periodstart date.. I tried to change this to =< but which cured it, but when running for 1D period length, this messed the figures up.
Can any one throw some advice on this one?
THanks
[/code]
I have looked at some reports to get an idea of how to do this, and came up with the following :
2 dataitems : item and item ledger entry : i have linked, and put filters on as required. ON the item ledger entry i have put the following :
OnPreDataItem() CurrReport.CREATETOTALS(TotalInvtQty,InvtQty); "Item Ledger Entry".SETFILTER("Posting Date",'>%1',ILEFilter); OnAfterGetRecord() Window.UPDATE(2,"Posting Date"); FOR i := 1 TO 3 DO IF ("Posting Date" >= PeriodStartDate[i]) AND ("Posting Date" < PeriodStartDate[i + 1]) THEN BEGIN InvtQty[i] := Quantity; IF InvtQty[i] <> 0 THEN PrintLine := TRUE; Test := PeriodStartDate[4] + 1; END;
When for example the user puts ending date = 20/02/07 the report runs ok, but the entries for 20/02/07 are not included in the totals. In the code I see there is "posting date" < periodstart date.. I tried to change this to =< but which cured it, but when running for 1D period length, this messed the figures up.
Can any one throw some advice on this one?
THanks

[/code]
0
Comments
-
Try to split the date array into StartDate and EndDate array with values like:
StartDate EndDate
01/01/07 20/01/07
21/01/07 .....
and use the limits including the boundaries (>= StartDate & <=EndDate)0 -
kine wrote:Try to split the date array into StartDate and EndDate array with values like:
StartDate EndDate
01/01/07 20/01/07
21/01/07 .....
and use the limits including the boundaries (>= StartDate & <=EndDate)
thanks for the replyfollowing your suggestion, i came up with the following, and it appears to have worked
Thats something else Ive learnt today!FOR i := 1 TO 3 DO IF ("Posting Date" >= PeriodStartDate[1]) AND ("Posting Date" <= PeriodStartDate[2]) THEN BEGIN InvtQty[1] := Quantity; END; IF ("Posting Date" > PeriodStartDate[2]) AND ("Posting Date" <= PeriodStartDate[3]) THEN BEGIN InvtQty[2] := Quantity; END; IF ("Posting Date" > PeriodStartDate[3]) AND ("Posting Date" <= PeriodStartDate[4]) THEN BEGIN InvtQty[3] := Quantity; END; IF InvtQty[i] <> 0 THEN PrintLine := TRUE;
[/code]0 -
If your problem is solved, do not forget to add [SOLVED] prefix into first post subject. Thanks 8)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