Profile picture for user gonzalezfox

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.

 

by Torsten Haase
Posted on Thu, 02/24/2011 - 15:20

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



 

0
by Pablo Gonzalez Author
Posted on Thu, 02/24/2011 - 18:06

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.

0
by Gilad Wilk
Posted on Thu, 02/02/2012 - 15:34

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

 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock