Hi everyone,
I need to extract a filter value from a repeater and use it to filter on another record in order to print a report.
The user select one or more lines on the repeater.
I wrote the following code:
CLEAR(ltextFilter);
lrMyRec:=Rec;
CurrPage.SETSELECTIONFILTER(lrMyRec);
ltextFilter := SelectionFilterMgt.GetSelectionFilterForLocation(lrMyRec);
SalesHeader.SETFILTER("Location Code",ltextFilter);
DocPrint.PrintSalesOrder(SalesHeader,Usage::"Usage 1");
SelectionFilterMgt is standard codeunit 46.
I get the filter for location for example this way: 'Loc1|Loc2'.
The thing is that when the report request page is displayed, the filter in displayed Location Code field is litterally
'Loc1|Loc2
'.
It should be just Loc1|Loc2
The report is trying to find a location with the exact code 'Loc1|Loc2' and finds nothing.
How shall I proceed with this?
Thanks in advance
Comments
Would this not work?
Where is the problem exactly?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
please check again. Do you indeed receive 'Loc1|Loc2' or rather 'Loc1'|'Loc2'?
The latter is, what SelectionFilterManagement used to return, using a rather simplistic quoting mechanism, quoting where no quotes are needed and not escaping embedded single quotes.
Are you setting the filter exactly as you show in your code? setting it like will use the ltextFilter filter expression literally as value for the code field, and so will SETRANGE.
Yes you are right, it is indeed 'Loc1'|'Loc2'.
and in my code:
SalesHeader.SETFILTER("Location Code",ltextFilter);
Is it correct? How can I get rid of the quotes?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
It is not working fine...
Here is what I get in the request page:
So the result is a blank page...
it should be '201'|'301'
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav