Profile picture for user m3b

Hi all,

I need to know if there exist models in our database which 

  • have versions
  • and whose "state" attribute (AT_STATE) has never had the value "released" (AVT_RELEASED) in any version

My thinking was :

  1. loop through all models 
    1. for every model , check if the model has versions (using : Context.getComponent("Versioning").getModelRevisions(model)
    2. for every version , look at the model state attribute value

I'm stuck at point "2" because getRevisions() returns RevisionInfo objects which give two kinds of information

  • a revision number
  • a ChangelistInfo object , which itself only gives : the time at which the revision has been made, by whom, etc

 I'm still at a loss to know how to retrieve the attribute values for the different model revisions 

Any ideas ? 

Thanks

MB

 

 

by Michel Bénard Author
Posted on Wed, 12/14/2022 - 20:52

I think I got it :

  • from the model get the revisions (version)
  • from the version get the change list
  • open the database using the changelist id 
  • find the model , get its state value 
  • compare 

 

0
by Michel Bénard Author
Posted on Thu, 12/15/2022 - 19:35

A few lines of code to illustrate one way to do it

var serverComponent = Context.getComponent("Versioning");
var versions = serverComponent.getModelRevisions(model); // model is a Model Object
var changelistId = versions[0].getChangeListInfo().getID(); // let's look at the model first revision

var currentDB = ArisData.getActiveDatabase();
var db = ArisData.openDatabaseVersion(currentDB.Name(0), changelistId);
var oldModel = db.FindGUID(model.GUID());
if (oldModel && oldModel.IsValid()) 
 {
 var modelState = oldModel.Attribute(Constants.AT_STATE_1,locale).MeasureUnitTypeNum();
 // do some work
}
db.close();

 

 

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