|
09.12.2010, 02:13 | #1 |
Участник
|
saveenr: More AX SSRS Screencasts and Instructions on Getting an AX Enum into a Report
Источник: http://blogs.msdn.com/b/saveenr/arch...-a-report.aspx
============== We are up to 25 screencasts as of last night. You can find the full list here: http://blogs.msdn.com/b/dynamicsaxbi...cast-list.aspxIn particular I want to call attention to Screencast 25: Getting the Values of an AX Enum into a Report I’ve pasted the code used to retrieve the Enum data into a DataTable public static System.Data.DataTable GetAXEnum(string enumname) { if (enumname == null) { throw new System.ArgumentNullException("enumname"); } var dt = new System.Data.DataTable(); dt.Columns.Add("Symbol", typeof(string)); dt.Columns.Add("IntValue",typeof(int)); dt.Columns.Add("Label",typeof(string)); var ax = Microsoft.Dynamics.Framework.Reports.SessionManager.GetSession(); int enum_id = (int)ax.CallStaticClassMethod("Global", "enumName2Id", enumname); var enum_obj = ax.CreateAxaptaObject("DictEnum", Convert.ToString(enum_id)); int val_count = (int)enum_obj.Call("values"); dt.BeginLoadData(); for (int i = 0; i < val_count; i++) { string symbol = (string)enum_obj.Call("value2Symbol", i); if (symbol.Length > 0) { int int_value = (int)enum_obj.Call("symbol2Value", symbol); string label = (string)enum_obj.Call("value2Label", i); dt.Rows.Add(symbol, int_value, label); } } dt.EndLoadData(); return dt; } Источник: http://blogs.msdn.com/b/saveenr/arch...-a-report.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|