Copy Filters one by one

txerifftxeriff Member Posts: 492
Hi all,

Hope you can help. Here it goes:
      T50006.RESET;
      T50006.SETRANGE("Setup No. Sequence",T50005."No. Sequence");
      IF T50006.FINDSET THEN
        REPEAT
          //create a "filtered" T27 so we can send it to the report and copy
          //filters to dataitem
            tobject.open(27);
            tfield:=tobject.field(T50006."Field No.");
            TField.SEtfilter(T50006."Filter Expresion");
            tobject.settable(T27b);
            t27.copyfilters(t27b); //does it overwrite???
        UNTIL T50006.NEXT=0;

What I try to do is the following:

-Tobject recordref "reads" the field number defined in T50006."Field No."
-Then tField is used to filter T50006."Filter Expresion"
-Value is set to T27B and then that value must be added to the filters in T27, added, not overwritten as we are into a loop.

Example of a row I would like to filter:

-T50006."field no."=1 //it would be Item.No.
-T50006."Filter Expresion"='1000' //it would try to filter item 1000
-then the value goes to T27B and copied to T27


How do I add the value to T27 without overwriting previous filters? As far as I know copyfilters overwrites and I can´t use (or I don´t know how to) copyfilter as I must provide source a field, not a fieldref.

Any ideas?

many thanks!
:D

Comments

  • KishormKishorm Member Posts: 921
    I don't have NAV in front of me, but something like this should work...
          T50006.RESET;
          T50006.SETRANGE("Setup No. Sequence",T50005."No. Sequence");
          IF T50006.FINDSET THEN BEGIN
            tobject.gettable(t27);
            REPEAT
                tfield:=tobject.field(T50006."Field No.");
                TField.setfilter(T50006."Filter Expresion");
            UNTIL T50006.NEXT=0;
            tobject.settable(t27);
          END;
    
  • txerifftxeriff Member Posts: 492
    thanks, it worked. I had the solution right there I guess I was tired. hehe.
Sign In or Register to comment.