Fetching a Label value from SQL AX

Coming from my previous blog post Get list of security roles with name , I extracted the label via SQL. I had to break up the Label ID into the Module and then the number.
This allowed me to then query the table ModelElementLabel to get the label value
Following code can get the Label via SQL
NOTE: you need to query the Model database for this
1
2
3
4
5
6
7
DECLARE @LabelStr as nvarchar(50)
Set @LabelStr = N'@SYS12345'
 
select * from ModelElementLabel L
    where L.Module = SUBSTRING(@LabelStr, 2, 3)
          and L.LabelId = SUBSTRING(@LabelStr, 5, 7)
        --and L.Language = 'en_us' -- Uncomment this line to filter by language
This way you wont need to search a label value from within Ax

Comments