Donnerstag, 15. Januar 2015


Dynamics AX 2012


How to get the Name and Value from an undefined table and field


while select * from SqlDictionary

where SqlDictionary.tabId == tableName2id(Tablename)

&& SqlDictionary.fieldId != 0





{


fieldname = SqlDictionary.sqlName;


dict = new SysDictField(SqlDictionary.tabId,SQLDictionary.fieldId);

label = strReplace(strReplace(SysLabel::labelId2String(Dict.labelLabel(),LanguageID),"-","_")," ","_");

if(label =="")






{


file.write(strFmt("%1%2.%3,",Praefix,Tablename,FieldName));






}


else





{


file.write(strFmt("%1%2.%3 as %4,",Praefix,Tablename,FieldName,Label));






}

Dynamics AX 2012


You know the table and the fieldid and you want the value of the field?






static void Job1(Args _args)






{


FieldId FieldID = 7;

Common common = CustTable::find("US-001");






;


info(strFmt("%1",Common.(FieldId)));






}
Dynamics AX 2012


Working with Expressions in Strings:


static void JOB1(Args _args)






{


str expr = 'ab==2';

str method = @'boolean eval(int ab){return ' + expr + ';}';

boolean result;






;


result = runBuf(method, 2);

info (strfmt("Calculation result is %1", result));






}