Hi,
I have a project for NAV2013R2 where i have to take some records of sales shipment line and sales invoice line and write them on custom table(with page action). Before this, the user can filter (when push the action page) records for POSTING DATE only month and year(for example if user set 04/2020, "process" write on the custom table only INVOICE OR DDT with POSTING DATE from 01/04/2020 to 30/04/2020)
How can do this??
Thanks so much and sorry for my bad english
0
Answers
small example:
BeginDate - date
StartDate - Date
SalesInvLine - record on Sales Invoice Line
FilterDate - set by user/ Example 01/04/2020
BeginDate := CALCDATE('<-CM>', FilterDate);
EndDate := CALCDATE('<-CM>', FilterDate);
SalesInvLine.RESET;
SalesInvLine .SETFILTER("Posting Date", '%1..%2', BeginDate, EndDate)
IF SalesInvLine.FINDSET THEN
REPEAT
UNTIL SalesInvLine.NEXT = 0;
But with your code, there is an error:
and then the date that set by user on filter on request page is only(Month/Year) without days... for example if i set 04/2020, take records of all April... if i set 05/2020, take records of all May
Thanks so much
UserYear - variable with year
BeginDate := DMY2Date(1, UserMonth,UserYear);
EndDate := CALCDATE('<CM>', BeginDate);
find out help about this function
https://docs.microsoft.com/en-us/dynamics-nav/dmy2date-function--date-
Var:
Name DataType Subtype Length
saleshipline Record Sales Shipment Line
ledger Record Ledger
But it didn't work.
Help me please
Thanks