web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

condition on an option type

(0) ShareShare
ReportReport
Posted on by

how to put values on an option after executing a condition like 

IF ("option111"="blanc") THEN
option222::"aaa","bbb","ccc","ddd","eee","fff";

this didn't work

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    Do you mean to say based on condition you need to fill another option value ?

  • Community Member Profile Picture
    on at

    yes

  • CristianAguerre Profile Picture
    147 on at

    Hi Sikanav,

    Maybe your want something like this:

    IF (option111  = option111::valueOption1) THEN BEGIN

        option222 := option222::valueOption1;

    END;

    Regards!

  • Suggested answer
    Yogesh Kulkarni_ Profile Picture
    1,762 on at

    You can use something like, as said by Cristian:

    IF (optionA  = optionA::valueOption1) THEN BEGIN

        optionB := optionB::valueOption1;

    END;

    or you can use integer values of the sequential list of Strings.

    Please refer below link for more information:

    https://msdn.microsoft.com/en-us/library/dd355166.aspx

     

    -Yogesh Kulkarni
    Please verify, if you find answer helpful.

  • Suggested answer
    RockwithNav Profile Picture
    8,646 Super User 2025 Season 2 on at

    Hey Sikanav,

    Either go ahed as recomended by CristianAguerre  OR you can to use like this

    IF OptionField = 4 Then BEGIN - You can use the Integer value.

  • AbduTeeyech Profile Picture
    428 on at

    Are you trying to modify the table field's data type through coding?

    U sure it is possible through coding to set data type of fields?

    Abdul.

  • Suggested answer
    4BzSoftware Profile Picture
    6,073 on at

    Hi Sikanav,

    Although you can use integer number (start from 0), it is recommended to use name value.

    For example, "Document Type" option field of "Sales Header" table with values "Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order".

    1. For comparing: you want to do something with Invoice (integer number is 2):

    - Recommended: IF ("Document Type" = "Document Type"::"Invoice") THEN BEGIN ...

    - Not Recommended: IF ("Document Type" = 2) THEN BEGIN ...

    2. For assigning: you want to assign Invoice value to Document Type

    - Recommended: "Document Type" := "Document Type"::"Invoice";

    - Not Recommended: "Document Type" := 2;

    3. For Filtering: you want to filter Document Type with Order or Invoice

    - Recommended: SETFILTER("Document Type", '%1|%2', "Document Type"::"Order", "Document Type"::"Invoice");

    - Not Recommended: SETFILTER("Document Type", '%1|%2', 1, 2);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans