Hi
I have Input Parameter as Posting Date in Report . I want to implement SetRange on 2 fields. If user enters Posting Date = 01/04.2017..31/05/2017 then Table should display only those records where (Posting Date is >= & <= Input Date) and (ReceiptDt is >= & <= Input Date)) .
Thanks
*This post is locked for comments
Hi,
If your "Posting Date" filter is from the DataSource (i.e. the actual field of the table), you may write the below code which doesn't require any variable:-
Record.SETFILTER("Receipt Date",Record.GETFILTER("Posting Date"));
The above solution will take care of both the cases.
Hi
My question is Do i need to create 2 separate variables or with POsting Date Filter it can be done. User can enter single Day or Range in Posting Date.
Thanks
If its a single day then you can use two satement -
IF STRPOS(FORMAT(InputDate),'..') = 0 THEN BEGIN //Take Care of multiple values
Record.SETFILTER("Posting Date", '%1', InputDate);
Record.SETFILTER("Receipt Date", '%1', InputDate);
END ELSE BEGIN //Take Care if single value.
Record.SETFILTER("Posting Date", '%1..%2',0D,InputDate);
Record.SETFILTER("Receipt Date", '%1..%2',0D,InputDate);
END
With your statement, it seems you are assuming that user will always enter a range in Input Date.
You can start with an error message if user does not enter a range like -
IF STRPOS(FORMAT(InputDate),'..') = 0 THEN
ERROR('Input Date should contain date Range');
After this what @hasitha says is correct. The Posting Date and Receipt date will be filter as you require.
It can be range or it can be single day
Hi
Do i need to create 2 separate variables (Start Date or End Date) or with Posting Date Filter alone it can be done.
I have one Input Condition if that is true then i want to filter records with Receipt Date on POsting Date Range. User may whatever enter in Receipt Date.
Thanks
Hi
You can either user setrange or setfilter
Rec.SETFILTER("Posting Date",'>=071417D&<=072117D');
Rec.SETRANGE("Posting Date",071417D,072117D);
This will filter and display only those records which have posting date >= 14th July 2017 and <= 21st July 2017
Instead of passing the dates directly like how I have written above, you have to add your field values.
Input Date can be a range like 01042017..30042017 or a single day like 30042017.
Hi
What is Input Date . I am accepting Date in Posting Date. In Posting Date user can enter 01042017..30042017
Thanks
Sohail Ahmed
2
mmv
2
Amol Salvi
2