settableview for several data items based on same table

itsmeitsme 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.

Comments

  • girish.joshigirish.joshi Member Posts: 407
    In the code, you could use copyfilters.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    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.
  • girish.joshigirish.joshi Member Posts: 407
    Right -- copyfilters would only work if the other data item was based on the same table.
  • itsmeitsme Member Posts: 8
    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?
  • girish.joshigirish.joshi Member Posts: 407
    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.
  • girish.joshigirish.joshi Member Posts: 407
    edited 2006-03-28
    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.
  • itsmeitsme Member Posts: 8
    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.
  • NicloNiclo Member Posts: 3
    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

    by
Sign In or Register to comment.