How to get two different forms from same menuitems based on enum value selection

I have created two forms with completely different fields , the name of both the forms are attributes. I have added a menu item in InventTable>Setup>Attributes.

I have a enum field with three values in it, suppose the values are a,b and c respectively. When i select value ‘a’ attribute form 1 should be open from the menu item and if i select value ‘b’ or ‘c’ form 2 should be open from the same menu item (attributes).

It’s easy. Let the menu item point to a class that makes the decision and calls the right form.

So i need to make a class in which i will write condition in which based on my enum values the form will be selected and have to link that class with that menu item ???

Yes.

Is there any other interpretation of what I wrote?

I found the solution of this problem.

Suppose i have form A and form B with name as ‘Attribute’ and with different fields in it. The ‘Attribute’ menu item is being displayed in Item Table as Setup>Attributes. I made my first menu item dissappear when condition in not satisfied and displayed the second menu item with same name when other enum value is selected. Hence , by this i am able to open both the forms with a single menuitem button.

I wrote the following code in InventTable>Datasources>InventTable>Active

if(InventTable.ItemGroupId == ‘Val1’ && InventTable.Enum== Enum::EVAL1)

{

attributes.enabled(True);

}

else

{

attributes.enabled(false);

attributes.visible(False);

}

if(InventTable.Enum== Enum::EVal2)

{

smylattrib.enabled(True);

smylattrib.visible(true);

}

if(inventtable.Enum== Enum::EVal3)

{

smylattrib.enabled(True);

smylattrib.visible(true);

}

else

{

smylattrib.enabled(false);

smylattrib.visible(False);

}

I’m glad that you’ve found a solution (although you had to change your requirements).

Nevertheless it’s amusing when claim that you’re “able to open both the forms with a single menuitem button” after explaining how you’re hiding the first menu item button and showing the second button. That’s not a single button, if my math is strong enough.

But if you look it functionally you will not find any difference as it will look the same menu button with two different forms based on selected enum values.

Yes, I agree. It demonstrates that what you asked for (“form 2 should be open from the same menu item be open from the same menu item”) wasn’t your actual business requirement. You focused too much at a single technical solution (“how”) instead of a bigger picture (“what”).

We obviously can work only with what you tell us, therefore we can’t know that you asked a wrong (too narrow) question.Please think of it when explaining your problem next time.