settableview for several data items based on same table

itsme
Member Posts: 8
There is a report containing two data items based on the same table (e.g. item). The report will be called from a form using a report variable:
item.SETFILTER("No.", '4711');
report.SETTABLEVIEW(item);
report.RUNMODAL;
My problem is, that the filter set by using SETTABLEVIEW only affects the first data item. How can I make the filter visible on the second data item?
Thanks.
item.SETFILTER("No.", '4711');
report.SETTABLEVIEW(item);
report.RUNMODAL;
My problem is, that the filter set by using SETTABLEVIEW only affects the first data item. How can I make the filter visible on the second data item?
Thanks.
0
Comments
-
In the code, you could use copyfilters.0
-
If the second dataitem is based on an other table you can call the SETTABLEVIEW statement for every dataitem.
Look at the segment form in CRM for an example.0 -
Right -- copyfilters would only work if the other data item was based on the same table.0
-
Thanks for your hints. I already tried them before but I had no success. I actually tried to use copyfilter in the OnOpenForm trigger because I have to know about the filter before the user sees the request form. I also tried to use FILTERGROUP, but the filter of the data item variable was always empty. How can I access the filter of the data item before the user has access to the request form?0
-
the easiest way would be to create a global variable of the same type within your report (Item for instance). Then create a set function for it e.g.
SetDataItem( VAR InDataItem : Record )
MyGlobalVar := InDataItem ;
and then in your code, call copyfilters with the variable you have just assigned to.0 -
Here is another approach:
Say your original report was like this:
Item1 <Item>
Item2 <Item>
you can make it this:
ParentItem <Item>
->Item1 <Item>
->Item2 <Item>
Set the Max Iteration on Parent Item to 1. Then copyfilters on both subrecords. make sure there is no dataitemlinkreference between Item1 or Item2 and parentItem.
Though this is probably just a worse version of the solution I posted earlier.0 -
The report has two data items of type item on the same level (no ident). SETTABLEVIEW only affects the first data item but not the second one. My goal is to affect both data items identically.0
-
hi
try this:
1) Create global variable of the same type as your dateitems (recItemSelectedFilters)
2) on OnPreDataitem 1 type:
recItemSelectedFilters.copyfilters(Dataitem1); //this store selected filters 3)on OnPreDataItem 2 type:
Dataitem2.copyfilters(recItemSelectedFilters); //this set filters on second dataitem
Most important is to set filters on OnPreDataItem
by0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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