Hi all,
i have a lot of "Person Type" objects that I want to change to "Position". Is that possible?
Thanks
Hello Carsten,
of course this report is very powerful and might bring the desired result for you. And it is recommendable to be cautious using it because all objects in the selected database will be affected.
An alternative could be to write a new macro or report that can be started on a single object or multi-selection of objects with same type. With this approach you can control what object(s) will get a new type. And you can include more intelligence into the transformation procedure. So it is possible to write a certain attribute value into another attribute of the new object type or to change the type of connections related to the object instead of simply reassigning the connections to the new object type.
Best Regards
Uwe
It depends on how you want to be helped. if you are going to handle it by custom scripts,
here are some simple code snippets which will help you
for (var i = 0 ; i < (objectDefs.length -1)+1 ; i++){
namePObj = objectDefs[i].Name(g_nloc);
//groupCurrent = objectDefs[i].Group();
objectDefs[i].ChangeGroup ( newGroup);
replacingObject = newGroup.CreateObjDef ("new object ttype", namePObj, g_nloc );
ooutfile.OutputLnF((i+1) + " - Object created:"+replacingObject.Name(g_nloc), "REPORT4");
transferTheAttr(objectDefs[i], replacingObject);
}
function transferTheAttr(objectDef, newObject){
var attrbutes = objectDef.AttrList ( g_nloc );
for (var i = 0 ; i < (attrbutes.length -1)+1 ; i++){
newObject.Attribute( attrbutes[i].TypeNum ( ), g_nloc ).setValue(objectDef.Attribute( attrbutes[i].TypeNum ( ), g_nloc ).getValue());
// temp = objectDef.Attribute( attrbutes[i].TypeNum ( ), g_nloc ).getValue();
ooutfile.OutputLnF(" - atrribute created:"+ newObject.Attribute( attrbutes[i].TypeNum ( ), g_nloc ).Type()+"=" + newObject.Attribute( attrbutes[i].TypeNum ( ), g_nloc ).getValue(), "REPORT4");
}
}
Hello Ayman,
of course the above code is not enough to replace objects. This is a potentially quite complex operation, because you have to care for the existing occurences, connection definitions and occurences, the aligned models and the attributes of the object to be replaced.
I propose you have a look into the above mentioned report script "Replace Object Types". You can open it in the Scripts-Component under Reports-Administration.
If you really want to replace all objects with a certain type in the whole database by another type, you might use this script. If you want to replace only single objects you might use parts of the script in a new report.
Best Regards
Uwe