C/AL Syntax

iqbalmadiqbalmad Member Posts: 179
SETFILTER(fieldname, NOT variable)

Can some1 tell me the correct syntax in C/AL.

Note that the variable is of data type CODE.

Thnkx

Comments

  • AlbertvhAlbertvh Member Posts: 516
    Hi iqbalmad

    The correct syntax would be something like this

    SETFILTER(FieldName,'<>%1',VARIABLE);
  • DenSterDenSter Member Posts: 8,307
    The second parameter of SETFILTER must be text type. If you want to do (fieldname,variable) you can do SETRANGE(fieldname,variable). This only works for ranges and single values though.
  • AlbertvhAlbertvh Member Posts: 516
    The second parameter of SETFILTER must be text type.

    Not if you are substituting the %1 in the SETFILTER statement. Then you have to have a matching type field.
    eg SETFILTER("Posting Date",'%1',WORKDATE);
    SETFILTER(Amount,'<>%1',VarAmount); // VarAmount type Decimal
    SETFILTER("No.",'%1..%2',Var1,Var2); // Var1 & Var2 type Code
    :)
  • DenSterDenSter Member Posts: 8,307
    In which case you are representing the value of a non-text type in a text type variable. The second parameter is a text type.
Sign In or Register to comment.