Hello everyone,
I'm trying to version a model by using ARIS report scripting code but I have a question regarding archive () method (Versioning class).
The help says:
archive ( ArisObject[] p_ToArchiveItems, String p_Description, VersioningOptions p_Options, boolean p_waitInCaseConcurrentVersioningRunning )
Which items are expected in the first parameter? I have tried to put the model only but it did not work.
My code is:
var itemList = new Array(); //Items Array itemList.push(???); //what should I add? var result = compVersioning.archive(itemList,"version 003",compVersioningOptions,true); //creating model versioning
I have tried also to put the model + objDefList but without success.
The help is not clear about this parameter.
I appreciate your help.
Best regards.
Hi Pablo,
your script ran into a disadvantage of a typed parameter. Using "new Array[]" creates an untyped array but the method Versioning.archive requires the parameter to be typed (ArisObject[]).
The only (but not very user-friendly) way is to pick a method of the API which returns models, call this method and empty the result array. Now you have an empty array of the correct type. For example:
function createModelArray() { var aModels = ArisData.getSelectedModels() while (aModels.length>0) aModels.pop() return aModels }
Afterwards you can add models to the result array and calling .archive() will succeed.
Best regards,
Torsten
Hi Mr. Torsten,
I've tried to use your function, it does not generate an error but the "result" variable is still "false".
Code:
var compVersioning = Context.getComponent("Versioning");
var compVersioningOptions = compVersioning.createOptions();
var oModels = createModelArray(); //your function
var result = compVersioning.archive(oModels,"version 004",compVersioningOptions,true);
The oModel variable has only one model. I have tried to use Models[0] also but it didn't work.
I guess that may be is missing some elements in the first parameter such as Database element, Group element, etc, but I'm not sure. Do you have any other tip?
Thanks in advance.
Hello Pablo,
I am guessing that it's bit too late, but for the next guy that will try to do it.
I also encountered the same problem,
i think that the missing piece would be
var TempModel = new Array
TempModel = TempModel.concat(Models[0])
compVersioning.archive(TempModel,"version 004",compVersioningOptions,true);
Best regards,
Gilad