mandag den 19. oktober 2009

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();
}
}

1 kommentar:

  1. thx for this, can be usefull

    I used to create a new project and click on the advanced filter/sort button
    then click on select enter the USR (or higher) layer
    to get the entire list of objects and then i compare the objects present in USR & VAR

    It would be awesome if your script could fill a project with all of these objects :)

    SvarSlet