SETFILTER vs. DataItemTableView

afarrafarr Member Posts: 287
edited 2004-06-09 in Navision Attain
In a report, can DataItemTableView always be replaced by SETCURRENTKEY and SETFILTER (in the OnPreDataItem trigger)?

Maybe this would affect PrintOnlyIfDetail (of a higher data item) or grouping?

Thanks,
Alastair
Alastair Farrugia

Comments

  • GmcGmc Member Posts: 9
    Its pretty much the same...
    Why did you decide to use code instead of DataItemTableView and what do you mean "affect"?
  • afarrafarr Member Posts: 287
    Hi Gmc,

    I have a Sales Order report, with

    WHERE(Document Type = CONST(ORDER))

    in its DataItemTableView.

    I wanted to use this report also for Sales Invoices. What I did in fact was:

    SalesHeader.SETRANGE("Document Type",SalesHeader."Document Type");
    REPORT.RUN(ReportID,TRUE,FALSE,SalesHeader);

    The report's Filter Form now shows this filter (even though "Document Type" is not included in ReqFilterFields) but that's OK.

    Alastair
    Alastair Farrugia
  • GmcGmc Member Posts: 9
    Thats what I think...
    The reports DataItemTableView will set the additional filter into Document Type = CONST(ORDER)) and you won't get Invoices there... Even if you put it OnPreDataItem, the filter in the DataItemTableView will be set.
  • kvbkvb Member Posts: 107
    Gmc wrote:
    Even if you put it OnPreDataItem, the filter in the DataItemTableView will be set.

    Not entirely, Gmc.

    Affar, you can easily replace DataItemTableView filter by using SETFILTER or SETRANGE OnPreDataItem.
    But you should use FILTERGROUP at first.

    The matter is that when you use SETRANGE or SETFILTER by default you use FILTERGROUP 0. And the DataItemTableView filter uses FILTERGROUP 2.

    So, all you need before SETRANGE is to set FILTERGROUP to FILTERGROUP 2.

    Here is the code you should write OnPreDataItem:
    "Sales Header".FILTERGROUP(2);
    "Sales Header".SETRANGE("Document Type", "Sales Header"."Document Type"::Invoice);
    
  • ATACHATACH Member Posts: 4
    Gms


    :lol::lol::lol:

    delirium
  • RobertMoRobertMo Member Posts: 484
    and do read help about setfilter, setrange, filtergroup and datatableview properties, etc...
    it will be much easier to use this functions when you understand them.
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Sign In or Register to comment.