Setting a filter in a report programmatically
rnshh
Member Posts: 22
Is it possible to set a filter programmatically for a DataItem in a report? I've used <dataitem>.setrange, <dataitem>.setfilter, passing a string with the desired filter. Each time I run the report, it appears to not have any filters at all!
Thx in advance.
Thx in advance.
Tim Lecander
ArcherPoint
ArcherPoint
0
Comments
-
You need to define the filter in the OnPreDataItem of the dataitem. Probably also the OnPreReport works but I only used it to save the filters and not to change them.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
You cannot set the "visible" filters on the request form in other way than setting the filter on the record passed to the report when running it. But you can set the filters in OnPreDataitem as Kriki wrote...0
-
it seems like there are three incomplete ways to do this:
1. OnPreDataItem
method: write code in this trigger to filter the recordset
advantage: quick and easy
disadvantage: no way to set the filter dynamically
2. custom function
method: create a function in your report to set the filter. Or at least the parameters to be used in method 1.
advantage: can set filters dynamically
disadvantage: you have to instantiate the report before you can set the filters
3. pass in filtered record
method: first set filters on recordset then callREPORT.RUN(ReportID, FALSE, FALSE, recordSet)
advantage: dynamic filtering wihtout having to instantiate the report first
disadvantage: you can only filter one table
correct me if I am wrong.0 -
kriki wrote:You need to define the filter in the OnPreDataItem of the dataitem. Probably also the OnPreReport works but I only used it to save the filters and not to change them.
Thanks to all of you for the quick reply. I had been setting the filter only at OnPreReport, I didn't think :oops: of placing it in OnPreDataItem.
Thanks so much, all!Tim Lecander
ArcherPoint0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
