Rotation in a report of the last month

markyT
Member Posts: 120
Hi, I've a report on, in sections, calculate the "Invoiced Quantity" rotation. It do it on the last 6 months, 3 months and it runs well. But and now I want 1 month (the last month), but I can't. I've the following:
//6 Months
"Item Ledger Entry".SETRANGE("Posting Date",CALCDATE('<-6M>',WORKDATE),WORKDATE);
//3 Months
WITH "Item Ledger Entry" DO BEGIN;
IF ("Posting Date" >= CALCDATE('<-3M>',WORKDATE)) AND
("Posting Date" <= WORKDATE) THEN
3Month:="Invoiced Quantity";
END;
How can I do the last month, please?
Thanks in advance.
//6 Months
"Item Ledger Entry".SETRANGE("Posting Date",CALCDATE('<-6M>',WORKDATE),WORKDATE);
//3 Months
WITH "Item Ledger Entry" DO BEGIN;
IF ("Posting Date" >= CALCDATE('<-3M>',WORKDATE)) AND
("Posting Date" <= WORKDATE) THEN
3Month:="Invoiced Quantity";
END;
How can I do the last month, please?
Thanks in advance.
0
Comments
-
markyT wrote://6 Months
"Item Ledger Entry".SETRANGE("Posting Date",CALCDATE('<-6M>',WORKDATE),WORKDATE);
//3 Months
IF ("Posting Date" >= CALCDATE('<-3M>',WORKDATE)) AND
How can I do the last month, please?0 -
IF you want to calculate between the first and last date of the month then:
SETRANGE("POSTİNG DATE",(calcdate('<CM-2M+1D>',WORKDATE)),(calcdate('<-CM-1D>',WORKDATE))
If you want to calculate this based on a day then -1M & +1MUfuk Asci
Pargesoft0 -
SETRANGE("POSTİNG DATE",(calcdate('<CM-2M+1D>',WORKDATE)),(calcdate('<-CM-1D>',WORKDATE)))
Thanks you very much, it works!!, but only a thing. I put it in a body section and in footers shows the variables of each rotation. If I put the code like this, all show the same rotation. I need dump the result to a variable as I did on 3 months for example. How can I do it please?.
Thanks for your help.0 -
Your question is not so much clear whatever you want can you show the screen shot of your report preview?
Your value is repeating, It seems that you have not initialized the variable.0 -
markyT wrote:
Thanks you very much, it works!!, but only a thing. I put it in a body section and in footers shows the variables of each rotation. If I put the code like this, all show the same rotation. I need dump the result to a variable as I did on 3 months for example. How can I do it please?.
Thanks for your help.
I didn't understand exactly. What's the difference between 3 months and 1 month? If 3 months works as you want then 1 month range should do too.
I suggest debugging. This way you can see what happens in your report step by step.Ufuk Asci
Pargesoft0 -
markyT wrote:
Thanks you very much, it works!!, but only a thing. I put it in a body section and in footers shows the variables of each rotation. If I put the code like this, all show the same rotation. I need dump the result to a variable as I did on 3 months for example. How can I do it please?.
Thanks for your help.
I didn't understand exactly. What's the difference between 3 months and 1 month? If 3 months works as you want then 1 month should do too.
I suggest debugging. This way you can see what happens in your report step by step.Ufuk Asci
Pargesoft0 -
Thanks for reply, I'll try to explain:
//First I calculate 6M:
"Item Ledger Entry".SETRANGE("Posting Date",CALCDATE('<-6M>',WORKDATE),WORKDATE);
//After 3M:
WITH "Item Ledger Entry" DO BEGIN;
IF ("Posting Date" >= CALCDATE('<-3M>',WORKDATE)) AND
("Posting Date" <= WORKDATE) THEN
Sum3M:="Invoiced Quantity";
END;
And now i want to calculate the last month. The I create Sum1M variable and try to do the code. I suppose that it should be as easy as do the same that with 3M did, but doesn't works. I've try that you answered:
SETRANGE("POSTİNG DATE",(calcdate('<CM-2M+1D>',WORKDATE)),(calcdate('<-CM-1D>',WORKDATE)))
but i can't asign it the result to my Sum1M variable. How can I do it please?.
Thanks in adavance.0 -
Can you show the whole code..0
-
Thanks, sorry but I try put the entire code but it says that there is too many characters. Also I try to attach the txt but says the same: "the txt contains too few characters".0
-
The code which you have written along with above code only..not all code in object..
and also where did you write?0 -
Thanks. Well, the code is almost what I had already written. I've have change some words and variables into English. Here it is:
{ PROPERTIES { DataItemIndent=1; DataItemTable=Table32; DataItemTableView=SORTING(Entry Type,Item No.,Variant Code,Drop Shipment,Location Code,Posting Date) WHERE(Entry Type=FILTER(Sale)); OnPreDataItem=BEGIN CurrReport.CREATETOTALS("Invoiced Quantity"); CurrReport.CREATETOTALS(Sum3M); CurrReport.CREATETOTALS(Sum1M); /////Last 6 months "Item Ledger Entry".SETRANGE("Posting Date",CALCDATE('<-6M>',WORKDATE),WORKDATE); END; DataItemLink=Item No.=FIELD(No.); } SECTIONS { { PROPERTIES { SectionType=Body; SectionWidth=18900; SectionHeight=0; OnPreSection=BEGIN month:= FORMAT(CALCDATE('<-1M>',TODAY),0,'<Month Text>'); WITH "Item Ledger Entry" DO BEGIN; IF ("Posting Date" >= CALCDATE('<-3M>',WORKDATE)) AND ("Posting Date" <= WORKDATE) THEN Sum3M:="Invoiced Quantity"; END; WITH "Item Ledger Entry" DO BEGIN; "Item Ledger Entry".SETRANGE("Posting Date",(CALCDATE('<-1M>',WORKDATE)),WORKDATE); Sum1M:="Invoiced Quantity"; END; END;
0 -
Cant we do it similar to 3M?
WITH "Item Ledger Entry" DO BEGIN; IF ("Posting Date" >= CALCDATE('<-1M>',WORKDATE)) AND ("Posting Date" <= WORKDATE) THEN Sum1M:="Invoiced Quantity"; END;
0 -
I can't believe it..... Indeed was it, already works =D> , but I had proved it, was the first thing I did but the result was not correct, maybe had some filter or something that was making the result was not correct, I don't know what happend.. :oops: .
Well, thank you very much for your help and time. Sorry for the dismissal.
Thanks again.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