Hi:
I am trying to move a package to another folder and the method obj.ChangeGroup(carpetaDest) works only with groups... anyone knows a different method for packages?
Thanks
Wait. Those "packages" you're talking about, are you talking about object definitions with the object type "Package"? As in objects with the API name OT_PACK?
The method "ChangeGroup(newGroup)" is a method of the report class "ObjDef". The report class "Group" inherits this method from ObjDef, therefore you can use someGroup.ChangeGroup(newGroup) to move one group to another group (<- all those groups I'm talking about are the "folders" you see in the ARIS Explorer).
With this this thing made clear, let's get to the gist of what I'm trying to say. "ChangeGroup(newGroup)" originally stems from the report class "ObjDef". Object definitions with the object type "Package" are used in Reports with the report class "ObjDef". Therefore it's illogical to say that "ChangeGroup(newGroup)" "only works with groups", when the original purpose of this method stems from the report class "ObjDef", where it is used to move object definitions around.
Take a look at the following report (Report context: Group; everything output related doesn't matter; the report needs permission to write to the database)
var nLocale = Context.getSelectedLanguage(); var selGroups = ArisData.getSelectedGroups(); //get the group with which you started the report for each(var selGroup in selGroups){ var testGroup1 = selGroup.CreateChildGroup("Test Group 1", nLocale); //in the selected original group create a sub-group called "Test Group 1" var testGroup2 = selGroup.CreateChildGroup("Test Group 2", nLocale); //in the selected original group create another group "Test Group 2" var testObjDef = testGroup1.CreateObjDef(Constants.OT_PACK, "Test Package Object", nLocale); //In Test Group 1 create an object definition with the object type "Package" testObjDef.ChangeGroup(testGroup2); //Move the object definition with the object type "Package" to the group "Test Group 2" testGroup1.ChangeGroup(testGroup2); //Move the (now empty) Test Group 1 into Test Group 2 //You now should have only one Test Group 2, in which you can find the object definition that was originally created in Test Group 1 and you can find the Test Group 1 inside Test Group 2 //You'll probably have to log off and on the database to see the changes }
^ I'm telling you that this is a valid, working script and that the method ChangeGroup can be used for object definitions as well as for groups. You use it with groupToMove.ChangeGroup(destinationGroup) and objectDefinitonToMove.ChangeGroup(destinationGroup).