Passing Option types in Functions

bmccarthybmccarthy Member Posts: 48
I have a form which does not relate to a table. It is purely an options dialog. Before showing the dialog I call a number of set methods to set the values in the dialog, after I call a number of get methods.

One of the values I set is of type OPTION. It is defined internally on that form.

Is there a way that when I call the Set of that option type that I can pass the type safe option string rather than an integer?

//In form
global optMyOption Option //Default, Send, Print

SetOption(optMyOption: Option)

//In calling code unit
myform.SetOption(???); what can I put here, is it possible to resolve the option types like optMyOption::'Default' etc

Comments

  • ara3nara3n Member Posts: 9,256
    you can copy the global variable optMyOption from where you are calling and then use the optMyOption::Send in your paramater.

    The issue with that is, you can change the global optMyOption in your form and the code will still work but you'll have two different global options.

    The only way you can enforce it is to have the option in a setup table. That way both the form and the code where the form is called can reference the same option.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.