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.
0
Comments
Look at the segment form in CRM for an example.
SetDataItem( VAR InDataItem : Record )
MyGlobalVar := InDataItem ;
and then in your code, call copyfilters with the variable you have just assigned to.
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.
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
by