Skip to main content

Merging code/elements in Layers

I've been assigned a task where the merge between VAR and CUS-layer of the application is necessary.

I like to make my self a TO-do-list of elements to be processed, so I can check an item when it is done.

I wrote a small job to identify elements in the application that were represented in both VAR and CUS-layers thus representing a potential layer-conflict.

The job produces an info-log with the potential conflicts that can be copied in to Excel to be used as a TO-DO-list.

static void JSOVarVapAndCusConflictsJob9(Args _args)
{
UtilIdElements utilIdElements;
UtilIdElements VarVapUtilIdElements;
Map elemMap;
MapIterator elemMI;
UtilElementType recType;
RecId utilId;
int pos;
str 60 elementName;

elemMap = new Map(Types::String,Types::String);
while select UtilIdElements
where (utilIdElements.utilLevel == UtilEntryLevel::cus)
&& UtilIdElements.parentId == 0
{
elemMap.insert(enum2str(UtilIdElements.recordType)+";"+num2str(UtilIdElements.recid,0,0,0,0),UtilIdElements.name);
}

elemMI = new MapIterator(elemMap);
while (elemMi.more())
{
pos = strscan(elemMI.key(),";",1,strlen(elemMi.key())-1);
recType = str2enum(recType,substr(elemMI.key(),1,pos-1));
// utilId = str2num(substr(elemMI.key(),pos+1,strlen(elemMI.key())-pos));
elementName = elemMi.value();

select firstonly VarVapUtilIdElements
where VarVapUtilIdElements.recordType == recType
&& VarVapUtilIdElements.name == elementName
&& (VarVapUtilIdElements.utilLevel == UtilEntryLevel::var ||
VarVapUtilIdElements.utilLevel == UtilEntryLevel::vap);
if (VarVapUtilIdElements.RecId)
{
info("Potentiel conflict between CUS- og VAR/VAP-lag: "+enum2str(recType)+" "+elemMI.value());
}
elemMi.next();
}
}

Popular posts from this blog

Dynamics Axapta: Sales Orders & Business Connector

Well, again folllowing my same idea of writting close to nothing and pasting code, I'll paste in some code to create a sales order from some basic data and the invoice it. I'll try to explain more in the future. AxaptaObject axSalesTable = ax.CreateAxaptaObject("AxSalesTable"); AxaptaRecord rcInventDim = ax.CreateAxaptaRecord("InventDim"); AxaptaRecord rcCustTable = ax.CreateAxaptaRecord("CustTable"); rcCustTable.ExecuteStmt("select * from %1 where %1.AccountNum == '" + MySalesOrderObject.CustAccount + "'"); if (MySalesOrderObject.CurrencyCode.Trim().Length == 0) MySalesOrderObject.CurrencyCode = rcCustTable.get_Field("Currency").ToString().Trim(); string sTaxGroup = rcCustTable.get_Field("taxgroup").ToString().Trim(); //set header level fields axSalesTable.Call("parmSalesName", MySalesOrderObject.SalesName.Trim()); axSalesTable.Call("parmCustAccount", M

Passing values between form and class

Class name is EmplDuplication and Form is EmplTable . void clicked() {    MenuFunction mf;    args args = new Args();    ;     args.record(EmplTable);     mf = new menufunction(identifierstr(EmplDuplication), MenuItemType::Action); mf.run(args); } Meanwhile, in the main() method of the EmplDuplication class, we need to put this Axapta x++ code to get the datasource: static void main(Args args) {     EmplDuplication EmplDuplication; EmplTable localEmplTable; ;     if(args.record().TableId == tablenum(EmplTable)) localEmplTable = args.record();     ... }