Enum as a Parameter in Dynamics AX
Asked Answered
A

3

1

My report has a parameter which uses a base enum. The enum has 4 different options to choose when running the report. How do I insert an option which uses all 4 at once?

For example, I have an enum named Phone and it has 4 types: 1 = None, 2 = Home, 3 = Mobile, 4 = Work. In a drop down, how do I add option 5 = None+Home+Mobile+Work?

Thank you!

Adulate answered 19/3, 2010 at 20:56 Comment(0)
L
1

Add anoher enum with value All (see NoYes and NoYesAll enums as example)

Likelihood answered 20/3, 2010 at 16:57 Comment(0)
S
1

Some ways to solve your problem:

  1. You can alter your Enum and add a new EnumValue with something like "All" (like AxCoder answer).

  2. If you don't want (or you can't) modify this Enum you can copy it and create a new Enum with the New value. It will be your responsability to maintain both syncronized with future changes.

  3. And you can leave the Enum without changes, and add another parameter to the report for you to know that the Enum value needs to be ignored by the Query (you have to code that beaviour, obviously)

Hope this helps.

Spiel answered 22/3, 2010 at 10:14 Comment(0)
F
1

You can add to the combo box on the form. If you use the enum on the form as a ComboBox, make sure the AutoDeclare property is Yes. Overwrite the Run() method of the form and add to the combo box after super.

Example:

public void run()
{
    super();
    YourComboBox.add("All");
}

On the modified method of the combo box, add the check for the word “All” by adding the code below before ret = super():

if (YourComboBox.getEditText() == "All")
{
        info("do your stuff"); //Add your code for the all selection here
}
Fluoride answered 7/12, 2010 at 14:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.