A report has a text field on the request form that is used to filter records. The file that the field filters is called within the report code, and is not therefore a data item that can be filtered the usual way. So, if the request form field contains “ABC”, then called records with this value in a particular field are skipped from processing. This works except for using wildcards in the request form field. What should be code line that tests the wildcarded request form field against called records look like ? Using “=” definitely doesn’t work. Thanks.
The report code currently looks like: Saleshead.GET(“Sales Line”.“Document Type”,“Sales Line”.“Document No.”); IF PreparedBy <> ‘’ THEN BEGIN IF UPPERCASE(Saleshead.“Prepared By”) <> UPPERCASE(PreparedBy) THEN CurrReport.SKIP; END; where Saleshead is the Sales Header table, PreparedBy the request form variable, and “Prepared By” is the Sales Header table to test. The report itself is based on the Sales Line table.
Hi Peter, TempFilter := ‘ABC*’; Customer.SETFILTER(Name, Tempfilter); shows all Customers where the name begins with ‘ABC’. So you have to use The SETFILTER-Command instead of SETRANGE. Greetings, Frank
I am having to guess what you are actually trying to do here. First glance implies that you just need to filter by PreparedBy, but you need to be amore clear. If in fact what you are trying to do is to skip a line depending on a value in the sales line, then just put a flow field in the sales line that does a lookup to the header, and then filter on this. If that’s not what you want, you will have to let on as to what you are trying to achieve, not how you want to do it.
Sorry. The report is a back order report based on the sales line and the reservation entry tables. The sales header is not declared as a data item. However, the sales header table is returned by a GET statement on the OnAfterGetRecord trigger of the sales line table to originally print the external document number from the sales header table on a group header section of the sales lines. However, as the sales header is returned by the GET, I am trying to use a request form field as a filter on the sales header to skip report output, if the Prepared By field on the sales header does not equal the entered text on the request form. For absolute values in PreparedBy, the report works ok. For entries on the request form with wildcards, nothing is returned.
Frank already made a correct statement. Record.SETFILTER(field,’%1’,value); allows you to use wildcards.
Hi Peter, IF Preparedby <> ‘’ THEN BEGIN __Salesheader.setrange(“Document type”, “Sales line”.“Document type”); __Salesheader.setrange(“No.”, “Sales line”.“Document No.”); __Salesheader.setfilter(“Prepared By”, Preparedby); __IF NOT Salesheader.find(’-’) THEN ____CurrReport.SKIP; END; Have not tested, but this should do the work. If the performance is bad, you have to create or use a key with the field “Prepared by” in it and SETCURRENTKEY. Greetings, Frank
It doesn’t appear to work on a “GET” record. The code now looks like: (this is on the OnAfterGetRecord trigger of the Sales Line table. Saleshead.GET(“Sales Line”.“Document Type”,“Sales Line”.“Document No.”); Saleshead.SETFILTER(“Prepared By”,’%1’,PreparedBy); IF PreparedBy <> ‘’ THEN BEGIN IF UPPERCASE(Saleshead.“Prepared By”) <> UPPERCASE(PreparedBy) THEN CurrReport.SKIP; END; Again for absolute values in PreparedBy, the CurrReport.Skip works. For wildcarded entries in PreparedBy nothing is returned. If the SETFILTER was on the Sales Line table I’d agree, but it’s on the Saleshead temp table.
Thanks, Frank, ,that did the trick nicely.