how to restrict enum element in morphx report dialog field

Hi DAX dudes…

I have query about the restriction of enum elements on report dialog field

scenario: here I am using report dialog field i.e enum type which has 6 enum elements but I need 2 elements to show in the lookup where rest of the elements should be hidden…

can anybody help in this…

thanks in advance…

could you please comment…

I would simply create a new enum.

Hi Krishna,

Please can you check the below blog, it may help you.

http://dynamicsaxgyan.wordpress.com/2013/02/12/dialogenumcombobox-class-in-ax-2012-x-restrict-enum-elements-in-the-dialog-fields/

thanks Martin.

Could you please let me know Is there any way to do this (using existing enum by hiding unwanted elements) through programming.

Thanks,

Krishna

You would have to construct and fill a combo box. The DialogEnumComboBox class, as Raghav mentioned, can help you with it.

Martin…it related to AX 2009 report dev…

Thanks Martin,Ragav for valuable feedback.

our client using Axapta 2009 Version.

The DialogEnumComboBox class is not available in this .

Could you please suggest if i’m wrong.

DialogEnumComboBox class is not available in AX 2009 . correct?

Try the following code in AX 2009,

SysFormEnumComboBox sysFormEnumComboBox;

Set enumSet;

enumSet= newSet(Types::Enum);

enumSet.add(Enum::A);
enumSet.add(Enum::B);
enumSet.add(Enum::C);
enumSet.add(Enum::D);

sysFormEnumComboBox = sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(Form,control)),enumNum(enum),enumSet);

Dear Ragav,

i tried its not working. its prompting error wrong usage of function

the code you are suggesting is it related to reports or forms bcz I need to handle this piece of code in dialog method of ax 2009 report

Dear all,

Could you please let me know whether it’s achievable one or not as it was about to close

As I already said: it’s possible, but you would have to use a normal combo box and fill it by yourself. Unless you need different values based on some runtime logic, simply create a new enum.

You can override enter method on your combobox use this for example:

public void enter()

{

// Removing Enums for ComboBox ProdParmScheduling_ShedDirection

this.delete(enum2str(ProdSchedDirection::ForwardFromTomorrow));

this.delete(enum2str(ProdSchedDirection::ForwardFromSchedStart));

this.delete(enum2str(ProdSchedDirection::ForwardFromSchedDate));

super();

}

Anyway there is a problem. Let say you want too keep first and last record. It will work well with the first but when you pick last it will return the value for second, so you can change it manualy, something like this:

ProdMultiSchedulingJob prodMultiSchedulingJob;

ProdSchedDirection prodSchedDirection;

ret = super();

if(ProdTable.ProdStatus == ProdStatus::Scheduled)

{

switch (ProdParmScheduling.SchedDirection)

{

case prodSchedDirection::ForwardFromToday:

prodParmScheduling.SchedDirection = ProdParmScheduling.SchedDirection;

break;

case prodSchedDirection::None:

break;

default:

ProdParmScheduling.SchedDirection = prodSchedDirection::BackwardFromDeliveryDate;

prodParmScheduling.SchedDirection = ProdParmScheduling.SchedDirection;

break;

}

}

ProdTable_ds.research(true);

Dear martin,

i would feel regret for extending this…

As i already mentioned i would like to implement this without creation of EDT or enum in Ax2009.

i have to implement this with runtime logic.

you replied " you would have to use a normal combo box and fill it by yourself. Unless you need different values based on some runtime logic".

is that supposed to means implementing this with existing enum.

if yes plz let me know how to do this as i’m not aware of this…

Dear Kristian

I need to handle this piece of code in dialog method of ax 2009 report

I’m not going to develop it for you, but at least I googled it for you:

You should try a search engine one day…

thanks Martin,

I could try .