filter the data by using enum?

I had Table(2 string field, 1 Enumfield) with the help of that I created on form , In form level I added one more field same as table level Enumfield . This enum is no relation with table ok, and In grid I used Table fields
My requirement is
By using form level Enumfield I want filter data in grid with related to same enum values
Means display the records in grid , where form level Enumvalue == in grid level enum
Example : if I select “customer” in form level enum then filter the records in grid . grid enum == “customer”

I wrote the code in form level Enumfield (modified method) like shown in below
QueryBuildRange =

filterdata = cmpOccupancy_ds.query().dataSourceName(‘cmpOccupancy’).addRange(fieldNum(cmpOccupancy,OccupantType)).value(enum2str(OccupantType1.selection()));

QueryBuildRange = Table_ds.query().dataSourceName(“datasource name”).addRange(fieldNum(Table,field)).value(enum2str(enum.selection()));

But not executed can any one help me?

If you add the enum to a form, use autodeclaration. Then you will user enuminform.value() instead of enum.selection().

On the form-object of the enum (which you can’t add from a datasource), you will have to have a modified where you run an table_ds.executeQuery();

maybe also on a jumpref method.

Did it make any sense?

Boss Mr. Oscar ,

in form level its not possible to take enum.value() for enums ,

only way is enum.selection();

to pass the enum value

Which version. I do it in a Ax 2009 and it works just fine. But I hade trouble with enum.selection() for some reason.