when writing lookups

When you create lookups and don’t know all details by heart, this example proves to be really useful. It was found somewhere in the Internet, so if you know where it is taken from please comment and I will link to the author blog post.

 

Query query = new Query();
 QueryBuildDataSource qbds;
 QueryBuildDataSource qbdsJoin;
 SysTableLookup sysTableLookup = sysTableLookup::newParameters( tableNum(VendTable), this);
 ;
 
 qbds= query.addDataSource( tableNum(VendTable));
 qbdsJoin= qbds.addDataSource( tableNum(DirPartyTable));
 qbdsJoin.relations( false);
 qbdsJoin.fields().dynamic(NoYes::Yes);
 qbdsJoin.addLink( fieldNum(VendTable, Party), fieldNum(DirPartyTable, RecId));
 qbdsJoin.joinMode(JoinMode::InnerJoin);
 
 sysTableLookup.parmQuery(query);
 sysTableLookup.addLookupfield( fieldNum(VendTable, AccountNum), true);
 sysTableLookup.addLookupfield( fieldNum(VendTable, VendGroup), true);
 sysTableLookup.addLookupfield( fieldNum(VendTable, Party));
 sysTableLookup.performFormLookup();
Advertisements

List of table attributes for upgrade script when upgrading account dimension field

Following script shall be used in the upgrade scripts when upgrading from ax 2009 to ax 2012. For more detailed information refer to the ” Implementing the Account and Financial  Dimensions Framework for Microsoft Dynamics AX 2012  Applications White Paper”

UpgradeScriptTableAttribute(tableStr(HcmWorker),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttribute),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeDirCategory),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeLevelValue),true,true,false,true),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValue),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueCombination),true,true,false,true),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueCombinationStatus),false,true,false,true),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueGroup),true,true,false,true),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueGroupCombination),true,true,false,true),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueGroupStatus),false,true,false,true),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueSet),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeValueSetItem),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeSet),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionAttributeSetItem),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionFinancialTag),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionHierarchy),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionHierarchyLevel),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionLedgerAccount),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionLedgerAccountValue),true,true,false,false),
UpgradeScriptTableAttribute(tableStr(DimensionValueGroupJournalControlStatus),false,true,false,true),
UpgradeScriptTableAttribute(tableStr(FinancialTagCategory),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(LedgerParameters),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(MainAccount),false,true,false,false),
UpgradeScriptTableAttribute(tableStr(Ledger), false, true, false, false)