Hi all,
I want to filter records from Sales Invoice Line table based on the month from Posting Date field with the value comming from request variable, so i have written the code.
Smonth ->Integer [used for receiving month value from request form]
"Sales Invoice Line".SETFILTER(DATE2DMY("Sales Invoice Line"."Posting Date",2),'%1',SMonth);
but its not allowing to use DATE2DMY function inside the SETFILTER function.
how can i achieve this.
0
Answers
You cannot use that.
SETFILTER is followed by the field on which you want to filter.
You will have to use variables and get the Starting date of the month and the ending date of the month.
Then do a SETRANGE("Posting Date",StartMonthDate,EndMonthDate) or the SETFILTER("Posting Date",'%1..%2,'StartMonthDate,EndMonthDate).
Have you read the documentation / help to figure out the syntax of the commands?
That will not fullful to requirment.
he wants entries with specific month filter either year would have 2001,2002,2003......so.
I think you(mkpjsr) have to extract each entry for calculate month and then use SETRANGE.
but it will create problem when you want to set filter on ONPREDATAITEM trigger.
let see more reply...
If that's the case then it would be better to create a field to store the month and filter on that.
in this case it can be best.
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool
Create a new blank form, put a button on it, and in the OnPush of that button, paste this code: The angle brackets are to keep translation issues out of the picture.
For putting a proper date filter into your SETFILTER, you're going to have to think about that. Think about what a proper date filter looks like, and make sure that the value that you put in there is a proper date filter. DATE2DMY returns an integer, and an integer is NOT a proper value for a date filter.
RIS Plus, LLC
but in my case month is not always the current month, then how to do
Try it, and see.
RIS Plus, LLC