Pre-filter report selection in NAV 2009 RoleTailored client.

I have a report that I want the filtering to be pre-populated with the currently selected record when it is run.

The report is based on a different table to the one that is used on the form/page.

In my form I have this code:

l_InterfaceProcessLogDetail.SETFILTER(“Log ID”, ‘%1’, ID);
REPORT.RUN(REPORT::“Interface Process Log”, TRUE, TRUE, l_InterfaceProcessLogDetail);

And when I click the button in the classic client this works perfectly.

The code gets transformed into the page correctly, but when I click the button on the page, it does not apply the filter to the Log ID field.

Has anyone come across how to do this yet?

I took a look at how this works on the Posted Sales Invoice, but unfortunately that is using CurrPage.SETSELECTIONFILTER(SalesInvHeader); and then passing the SalesInvHeader to the report.

Maybe this is the trick to make it work, but I can’t do this because I am running the report on a different table, and so SetSelectionFilter is no good for me.

1 Like

hi, I didn’t try it yet in rt client, it is working in classic - so have you tried

tablevar.setfilter …

reportvar.**settableview(**table) (using instead your code)



or create a function in the report and

pass the value to the function, set filter in the report, and then run the report

Hi Rene,

OK mystery is solved. I ended up using the reportvar.**settableview(**table) code and it works a charm, but it didn’t at first and I suspect the reason for this was why the Report.RUN with a record parameter didn’t work. It was nothing to do with the potential differences between the RTC and Classic client, but was instead a dumb programming error. [:$]

I originally had a OnPushAction property against me menu button in the classic client and when I realised I couldn’t pass the current record (since they are on different tables) I put the code in the OnPush() trigger instead - but by mistake I left the properties set. Then when I transformed the Form to an RTC page, the properties were being executed and not my code - hence the record filtering was never being passed. I only spotted this because the Classic client will actually run the report twice - once for the properties against the button and once for the code, whereas the RTC only ran the report once - for the properties.

Thanks for taking the time to help.