fieldref.Setfilter on Primary key fields - does not work ?

activ8activ8 Member Posts: 25
Hello,

I want to place a filter on a fieldref, this works fine but
from the moment i want to do this on fields that part of the primary key,
the filter does not seems to work. (NAV 4.0SP3)

refRecord.OPEN(18);
fieldRef := refRecord.FIELD(2); --> Name field of customer table
fieldRef.SETFILTER('*test*'); --> this worksfine if the fieldref is not a primarykey field for example the name field.
IF refRecord.FIND('-')
REPEAT
... --> only the customers with test in the name = OK
UNTIL refRecord.NEXT = 0;
END;


refRecord.OPEN(18);
fieldRef := refRecord.FIELD(1); --> No. field of customer table = Primary Key
fieldRef.SETFILTER('K00001|K00011');
IF refRecord.FIND('-')
REPEAT
... --> all the customer records = NOT OK
UNTIL refRecord.NEXT = 0;
END;


Any what causes this problem ?

Comments

  • krikikriki Member, Moderator Posts: 9,110
    I tried it and it works. But I had problems with "fieldRef". I had to rename it.

    This is the code for a Cronus:
    rer.OPEN(18);
    fir := rer.FIELD(1);
    fir.SETFILTER('10000|20000');
    IF rer.FIND('-') then
    REPEAT
      fir := rer.field(1);
      MESSAGE('<%1>',fir.value);
    UNTIL rer.NEXT = 0;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.