Filter in report

clemboclembo Member Posts: 122
I have a processing only report. Two indent dataset: item, Item Ledger Entry.

In "Item Ledger Entry" OnPreDataItem trigger there is three SETRANGE:

SETRANGE(Exported,FALSE);
SETRANGE(Exportable,TRUE);
SETRANGE("Posting Date",DateFilter);

In "Item Ledger Entry" OnAfterGetRecord :

Exported := TRUE
MODIFY;

So my target is mark exported every record in "item ledger entry" for each item when meet filter.
But strange think is that Nav after loop first record in "Item ledger entry" mark it but skip other record of same item

Seems MODIFY instruction change all records of specific item.
If remove Exported := TRUE instruction all work and it loop all records

Why this?

Comments

  • dansdans Member Posts: 148
    Because the field that you modified (Exported) is part of your filters.
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • clemboclembo Member Posts: 122
    Ok. But why it change all record field and not one record every loop?

    I want to change field exported for every record..
    ](*,)
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    What is the sorting key in ILE?

    Why do you need Item Dataitem here?
  • dansdans Member Posts: 148
    why not use MODIFYALL ?
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • vijay_gvijay_g Member Posts: 884
    Modifyall will also not work here try to use it on onafterget record of Item ledger entry.
    ItemLedEntry.Get("Item ledger entry"."Entry No.");
    ItemLedEntry.exported := true;
    ItemLedEntry.modify;
    ItemLedEntry is recordvar of Item Ledger Entry
    
  • ssinglassingla Member Posts: 2,973
    If this is One off job and Table ILE size is not too big then you can think of

    In "Item Ledger Entry" OnPreDataItem trigger there is three SETRANGE:
    //SETRANGE(Exported,FALSE);
    SETRANGE(Exportable,TRUE);
    SETRANGE("Posting Date",DateFilter);
    
    In "Item Ledger Entry" OnAfterGetRecord :
    IF Exported = FALSE THEN BEGIN
      Exported := TRUE
      MODIFY;
    END;
    
    CA Sandeep Singla
    http://ssdynamics.co.in
  • ssinglassingla Member Posts: 2,973
    If there is no other consideration then using record variable can be better.

    Dataitem : Item
    OnAfterGetRecord Trigger
    ItemLedgEntry.SETRANGE("Item No.","No.");
    ItemLedgEntry.SETRANGE(Exportable,TRUE);
    ItemLedgEntry.SETFILTER("Posting Date",'%1',"Date Filter");
    IF ItemLedgEntry.FINDSET THEN
      ItemLedgEntry.MODIFYALL(Exported,TRUE);
    
    CA Sandeep Singla
    http://ssdynamics.co.in
  • dansdans Member Posts: 148
    MODIFYALL will work if you use a variable. Instead of changing one record at the time with MODIFY, it is better to use MODIFYALL.
    The question is why do you use the data item instead of variable ?
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • vijay_gvijay_g Member Posts: 884
    dans wrote:
    MODIFYALL will work if you use a variable. Instead of changing one record at the time with MODIFY, it is better to use MODIFYALL.
    The question is why do you use the data item instead of variable ?

    Yes exactly if the purpose is only to modify record then why don't you use record var instead of dataitem.
Sign In or Register to comment.