Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

condition on an option type

Posted on by Microsoft Employee

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

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: condition on an option type

    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);

  • AbduTeeyech Profile Picture
    AbduTeeyech 422 on at
    RE: condition on an option type

    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
    RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: condition on an option type

    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.

  • Suggested answer
    Yogesh Kulkarni_ Profile Picture
    Yogesh Kulkarni_ 1,762 on at
    RE: condition on an option type

    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.

  • CristianAguerre Profile Picture
    CristianAguerre 145 on at
    RE: condition on an option type

    Hi Sikanav,

    Maybe your want something like this:

    IF (option111  = option111::valueOption1) THEN BEGIN

        option222 := option222::valueOption1;

    END;

    Regards!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: condition on an option type

    yes

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: condition on an option type

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans