static void Job_ExportAOTObject(Args _args)
{
TreeNode treeNode;
FileIoPermission perm;
str treeNodeName;
str path;
// #AOT is defined in the AOT under Macros.
#AOT
;
//Replace with '\Classes' for class and '\Forms' for form
treeNode = TreeNode::findNode(@'\Data Dictionary\Tables';);
treeNode = treeNode.AOTfirstChild();
while(treeNode)
{
treeNodeName = treeNode.treeNodeName();
path = @'C:\AOT\' + treeNodeName + '.xpo';
perm = new FileIoPermission(path, 'w');
if (perm == null)
{
throw error('Unable to create file for ' + treeNodeName);
}
perm.assert();
treeNode.treeNodeExport(path);
CodeAccessPermission::revertAssert();
treeNode = treeNode.AOTnextSibling();
}
}
// Uses the full path to obtain the node for the new enum element
// that this job creates near its completion.
tnode2Enum = TreeNode::findNode(#BaseEnumsPath);
static void Job_ExportAOTObject(Args _args)
{
TreeNode treeNode;
FileIoPermission perm;
str treeNodeName;
str path;
EnumId enumId;
DictEnum dictEnum;
int count;
int counter;
// #AOT is defined in the AOT under Macros.
#AOT
;
//Replace with '\Classes' for class and '\Forms' for form
treeNode = TreeNode::findNode(#BaseEnumsPath);
treeNode = treeNode.AOTfirstChild();
while(treeNode)
{
treeNodeName = treeNode.treeNodeName();
enumId = enumNum(treeNodeName);
dictEnum = new DictEnum(enumId);
count = dictEnum.values();
for(counter = 0; counter < count; counter ++)
{
// You can use the number of method exposed by DictEnum class
// dictEnum.name(counter)
// dictEnum.index2Value(counter)
// dictEnum.index2Symbol(counter)
// dictEnum.index2Label(counter)
}
treeNode = treeNode.AOTnextSibling();
count =0;
}
}
http://swapnakallu.blogspot.in/2012/11/dictenum-class-in-ax2012.html
https://msdn.microsoft.com/en-us/library/cc967395.aspx
http://axaptacorner.blogspot.in/2012/03/create-enum-dynamicaly-by-code.html
http://www.agermark.com/2008/01/get-literal-label-of-enum-value.html
http://www.schweda.net/blog_ax.php?bid=478&wdl=en
http://arsalanax.blogspot.in/2012/02/get-values-of-base-enums-using-code-in.html
http://mcr-tinavdvyver.rhcloud.com/list-of-table-fields-and-types-in-csv-file/
http://mcr-tinavdvyver.rhcloud.com/cross-reference-of-sorts-for-base-enums/
http://www.johanmulder.com/?p=19
//Traverse tables and for each table traverse fields using AOT
http://blog.soenderhousen.dk/2012/09/28/85
List all the objects on menus
(forms/Reports) AX 2009/ 2012
http://dextersdax.blogspot.in/2015/10/list-all-objects-on-menus-formsreports.html
1. //Tina van der Vyver
2. //makecreatereiterate.com
3. static void ListFields(Args _args)
4. {
5. #File
6. DictField dictField;
7. DictTable dictTable;
8. DictType dictType;
9. DictEnum dictEnum;
10. FieldId fieldId;
11. Types type;
12. TableName tableName = tableStr(BatchJob);
13.
14. str enumValues, stringLength, stringType;
15. int i;
16.
17. CommaTextIo commaTextIo;
18. FileIOPermission permission;
19. str fileName = strFmt(@"C:\%1.csv", tableName);
20. ;
21. permission = new FileIOPermission(fileName, #io_write);
22. permission.assert();
23.
24. commaTextIo = new CommaTextIo(fileName ,#io_write);
25. dictTable = new dictTable(tableName2Id(tableName));
26. fieldId = dictTable.fieldNext(0);
27.
28. if (fieldId)
29. {
30. commaTextIo.write("Displayed name", "Technical Name", "Data Type");
31. }
32.
33. while (fieldId)
34. {
35. dictField = new DictField(tableName2Id(tableName), fieldId);
36.
37. if (dictField && !dictField.isSystem())
38. {
39. type = dictField.baseType();
40.
41. switch (type)
42. {
43. case Types::String:
44. dictType = new DictType(dictField.typeId());
45. stringLength = (strFmt("%1[%2]",type,
dictType.displayLength()));
46.
47. commaTextIo.write(dictField.label(), dictField.name(),
stringLength);
48. break;
49.
50. case Types::Enum:
51. dictEnum = new DictEnum(dictField.enumId());
52.
53. for (i = 0; i < dictEnum.values(); i++)
54. {
55. if (i == 0)
56. {
57. enumValues = "Enumeration: ";
58. }
59. else
60. {
61. enumValues += "/";
62. }
63.
64. if (dictEnum.value2Name(i))
65. {
66. enumValues += dictEnum.value2Name(i);
67. }
68. else
69. {
70. enumValues += dictEnum.value2Name(i);
71. }
72. }
73.
74. commaTextIo.write(dictField.label(), dictField.name(), enumValues);
75. enumValues = '';
76. break;
77.
78. default:
79. stringType = strFmt("%1", type);
80. commaTextIo.write(dictField.label(), dictField.name(),
stringType);
81. break;
82. }
83. }
84. fieldId = dictTable.fieldNext(fieldId);
85. }
86. CodeAccessPermission::revertAssert();
87. }