Field Filter for option variable

elysaval
elysaval Member Posts: 24
Hi, I have a variable of type Option (Example DocType = Quote,Order,Invoice), i set this variable as the Source Expr of a control in a form = ctrlDocType. In ctrlDocType I set the Option String (the same of the variable). Now I'd like to use this control to input a filter like : Order|Quote, but the error is 'Order|Quote' is not an option. How to filter an option control in this way ? for example using Navision Standard Field Filter on an option field it allows you to input a filter using | or &....

I tried ti use a Text variable and leaving the option string only in the ctrlDocType, but in this way i haven't the dropdown button nor a message of error if the option doesn't exist.

Can you hel me ? Thanks. Elisa.

Comments

  • kriki
    kriki Member, Moderator Posts: 9,127
    Is this what you want (I didn't understand exactly what you mean):
    SETFILTER(DocType,'%1|%2',DocType::Quote,DocType::Order);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • elysaval
    elysaval Member Posts: 24
    [-X No, it's not this, too simple !

    I give you an example : you are in Object Designer, you are positioned in Type column (wich is an option field), you push the navision field filter and digit 'Table|Report', and OK.

    I want my textbox behave like navision field filter, i mean i want to digit in my textbox Option1|Option2 and not having the error 'Option1|Option2 is not an option'.

    More clear now ? THANKS. Elisa.
  • ssi
    ssi Member Posts: 39
    Replace the option control with a text control. Text variable should be length 80 or greater. Add the following code in the OnAfterValidate of the text control:
    SETFILTER("Document Type", TextVar)
    
  • kine
    kine Member Posts: 12,562
    and you can add this line
      TextVar := GETFILTER("Document Type");
    
    To "translate" user entered short form of filter like '1|2' or 'I|O' to 'Quote|Invoice'.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • elysaval
    elysaval Member Posts: 24
    In this way i haven't drop down button ! And I haven't the error for wrong choises.

    Thanks anyway, i think the only way is to define a flowfilter in the table.