This little script creates an Excel .CSV (text) file of complete Data
Dictionary of current Axapta environment. Handy when you need
to have a collected list of all tables and there fields with types etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | static void FO_ReadDictionary(Args _args) { Dictionary dictionary = new Dictionary(); DictTable dt; DictField df; int j; CommaIO out; str sBaseType, sEnumType, sExtended; str sLength; container GetTypes(DictField _df) { EnumId eId; DictType dType; DictEnum de; extendedTypeId xtId; str sBase, sEnum, sExtend; Types eType = _df.baseType(); ; switch(eType) { case Types::AnyType : sBase = "AnyType"; break; case Types::BLOB : sBase = "BLOB"; break; case Types::Class : sBase = "Class"; break; case Types::Container : sBase = "Container"; break; case Types::Date : sBase = "Date"; break; case Types::DateTime : sBase = "DateTime"; break; case Types::Enum : sBase = "Enum"; eId = df.enumId(); if(eId != 0) { de = new DictEnum(eId); if (de) sEnum = de.name(); } break; case Types::Integer : sBase = "Int"; break; case Types::Real : sBase = "Real"; break; case Types::Record : sBase = "Record"; break; case Types::RString : sBase = "RStr"; break; case Types::String : sBase = "Str"; break; case Types::UserType : sBase = "UserType"; break; case Types::VarString : sBase = "VarStr"; break; case Types::void : sBase = "Void"; break; } xtId = _df.typeId(); if (xtId != 0) { dType = new DictType(xtId); if (dType) sExtend = dType.name(); } return [sBase,sEnum,sExtend]; }; // Creating new file with write access out = new commaIO("C:\\temp\\Dictionary.csv","w"); // Setting up Record delimiters out.outRecordDelimiter("\r\n"); out.outFieldDelimiter(";"); // Write CSV header out.write( "!Table.Field", "BaseType", "Length", "EnumType", "Extended" ); // loop through complete dictionary dt = dictionary.tableObject(dictionary.tableNext(0)); while (dt) { // loop through one table for(j=1; j <= dt.fieldCnt(); j++) { df = new DictField(dt.id(), dt.fieldCnt2Id(j)); [sBaseType,sEnumType,sExtended] = GetTypes(df); if(df.stringLen()) sLength = int2str(df.stringLen()); else sLength = ""; out.write( dt.name() + "." + df.name(), sBaseType, sLength, sEnumType, sExtended ); } // Get next table dt = dictionary.tableObject( dictionary.tableNext(dt.id())); } out = null; info("Dictionary read done!"); } |
Last 5 posts in Development
- No valid document identified from the entity key - April 9th, 2010
- Using Regular Expressions in Dynamics AX - October 2nd, 2009
- Create class and methods in x++ - December 22nd, 2008
- Simple field lookup in form - October 13th, 2008
- Get your Intercompany CustAccount - September 29th, 2008
Pingback from IT Pro Ramblings.