Hi All,
Has anyone successfully change a table field's property (especially
ExtendedDataType) using AOTSetPropertiesExt in AX 2009 SP0/SP1 by using
AOTSetPropertiesExt?
Whenever I tried to run below job, it crashed at AOTSetPropertiesExt
statement. I had experience to make it run once before, but maybe I was lucky.
static void Job6(Args _args)
{
#define.TableName( 'TSTTestTable' )
#define.FieldName( 'TestField' )
#AOT
#Properties
TreeNode a,b,c;
AOTTableFieldList fields;
Struct s;
Map map = new Map(Types::String, Types::String) ;
Counter propertiesCount;
Array propertyInfoArray;
Struct propertyInfo;
str propertyValue;
int i;
;
//create table
a = infolog.findNode( #TablesPath) ;
b = a.AOTfindChild( #TableName) ;
if (!b)
{
b = a.AOTadd(#TableName );
b.AOTsave();
}
//create field
fields = b.AOTfindChild( 'Fields') ;
c = fields.AOTfindChild (#FieldName) ;
if (!c)
{
fields.addString( #FieldName) ;
c = fields.AOTfindChild (#FieldName) ;
b.AOTsave();
}
//set field's properties
s = c.AOTgetPropertiesE xt();
map.insert(# PropertyExtended DataType, 'SalesId');
propertiesCount = s.value('Entries' );
propertyInfoArray = s.value('PropertyIn fo');
for (i = 1; i <= propertiesCount; i++)
{
propertyInfo = propertyInfoArray. value(i);
if (map.exists( propertyInfo. value('Name' )))
{
propertyValue = map.lookup(property Info.value( 'Name'));
propertyInfo. value('Value' , propertyValue) ;
}
}
c.AOTsetPropertiesE xt(s);
b.AOTsave();
}
If I run it on AX 4 SP2, it didn't crash, but the string size is wrong (2
instead of 10 as in SalesId). But second run will give 10 in string size.
Is it as simple as 'unstable'?
If I use normal AOTSetProperties, sometimes it hang or took very long time
to finish (either 30 seconds or forever).
Regards,
Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now
http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline