Dear all,
I have to filter date in request form for customer ledger entry .I have written the code in predata item in cust.ledger entry report as follows .
CustledgerEntry.SETRANGE(“Posting Date”); But this is not filtering . Please provide me the correct syntax which filters according to posting date wise .
With regards,
R.Ramanathan
You have asked this question on the other topic, and the answer is to give the user the Posting Date as a ReqFilterField, there is no code required that way.
Please look at the help files or other code examples:
SETRANGE(“Posting Date”,TODAY);
SETRANGE(“Posting Date”,WORKDATE);
SETRANGE(“Posting Date”,0D,TODAY);
SETRANGE(“Posting Date”,FromDate,311299D);
SETRANGE(“Posting Date”,FromDate,ToDate);
SETRANGE(“Posting Date”); will clear any filters already set.
David
Dear david,
When i gave this coding for date filter SETRANGE(“Posting Date”,StartDate,EndDate); Im getting records only filtered for the first posting date for customer ledger entry table i.e the datefilter i gave is 311207 . Please suggest me the correct syntax with example , need to get filter for in between dates.
With regards,
R.Ramanathan
As already said why are you needing to code the date range why not just give them the ReqFilterField then they can put in any range, and you do not have to add any code for this to work?
But here are some code examples, if you do not understand these then you will need more training, the SETRANGE can have one or two value options
SETRANGE(Field, Value); as in your example 311207 will only give entries for that day
SETRANGE(Field, Value1,Value2); example 010107 and 311207 will give all entries including and between the dates (Date Range)
//For a Date Range
StartDate := 01012007D;
EndDate := 31122007D;
SETRANGE("Posting Date",StartDate,EndDate);
//Up to today's Date
SETRANGE("Posting Date",0D,TODAY);
//From a Date
StartDate := 01012009D;
SETRANGE("Posting Date",StartDate,31129999D);
//Just for a Single Date
SETRANGE("Posting Date",Today);
David
Dear david,
I need to set the date filter till the given date .
Ex; Start Date : 081101
EndDate : 080112
If i give the date 210108 till that date the amount should get displayed…Please suggest me the syntax…
With regards,
R.Ramanathan
Not sure if this is what you mean, all entries to the end date?
If so create a date variable EndDate, add a textbox with a SourceExpr = EndDate to the Request Form
Then you would code on Cust. Ledger Entry OnPreDataItem
IF EndDate <> 0D THEN
SETRANGE("Posting Date",0D,EndDate);
This is my last post on this Topic as you have enough information in the two posts for a solution, if you do not grasp it from what has been written then you need more developer code training which is beyond the forums role.
David
You already have the syntax, more than once. What don’t you understand?
David,
Genius - thanks. I needed to filter a dataport using a calc. date so that I could automate the extract. Saved me a lot of time (as I am no developer!).
Sue
I was also facing the same situation of how to use date filter syntax…Thanks a lot David… it helped me a lot…