Dynamics AX 2012 SQL Extraction of Base Enum Values
Asked Answered
P

3

6

Is there a table, view, or procedure I can use to extract the values from a Base Enum using SQL (straight from the DB, not within X++)? I was able to find an isolated few in the table SRSAnalysisEnums but not the enum I need in particular.

Pyrites answered 8/1, 2013 at 21:7 Comment(0)
S
4

If you are trying to access the Enums from outside AX (for example in sql) you can add the missing enums to SRSAnalysisEnums by adding the containing table to a perspective and rebuilding the models

Tools->Reporting tools->Update models

It is described here http://abraaxapta.blogspot.co.uk/2012/02/missing-enums-in-srsanalysisenums.html

And an different AX2012-only way of doing it

http://abraaxapta.blogspot.co.uk/2012/11/accessing-enum-labels-from-outside-ax.html

Hope this helps

Sliding answered 9/1, 2013 at 8:33 Comment(2)
This did the trick (2012 version). I only had to modify the query to iterate through the enum indexes and stored the values in a temp table.Pyrites
Another reference for 2012 would be: ioi.solutions/…Salify
A
4

Looping over enums is dead easy:

static void EnumIteration(Args _args)
{
    DictEnum enum = new DictEnum(enumName2Id("TestEnum"));
    int i;
    for (i=0; i < enum.values(); i++)
    {
        info(enum.index2Label(i));
    }    
}

Roll it on your own table.

Ardithardme answered 8/1, 2013 at 22:58 Comment(1)
This helped me checking if a string value matches one element of an enum. Comparing my string with all the labels of elements has a meaning in my scenario so this is great. Thanks Jan!Airsick
S
4

If you are trying to access the Enums from outside AX (for example in sql) you can add the missing enums to SRSAnalysisEnums by adding the containing table to a perspective and rebuilding the models

Tools->Reporting tools->Update models

It is described here http://abraaxapta.blogspot.co.uk/2012/02/missing-enums-in-srsanalysisenums.html

And an different AX2012-only way of doing it

http://abraaxapta.blogspot.co.uk/2012/11/accessing-enum-labels-from-outside-ax.html

Hope this helps

Sliding answered 9/1, 2013 at 8:33 Comment(2)
This did the trick (2012 version). I only had to modify the query to iterate through the enum indexes and stored the values in a temp table.Pyrites
Another reference for 2012 would be: ioi.solutions/…Salify
I
2

SELECT A.ENUMITEMVALUE, A.ENUMITEMLABEL AS ENUMITEMNAME FROM [DBO].SRSANALYSISENUMS A WHERE A.ENUMNAME = 'LedgerPostingType' AND A.LANGUAGEID = 'en-us'

straight from SQL table

Ideogram answered 12/8, 2019 at 8:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.