Hello
I have a few model-reports create with scripting. Now I would like to enhance these reports with version-informations, so when a report is startet on a specific version, that in the report is a revision-id and the description of the revision.
How can i find out these informations, when the user starts the report on a model-version or when the user is logged in the database with a selected version and starts the report on the model?
I work with Service-Release 2010-08.
Looking forward to all your responses.
Thanks & Regards
Roman
Apparently versioning information are not accessible for reports like model/object attributes,
c.f. this topic
THanks for the answer.
This may be correct for the report wizzard, but not for scripting. There is a standard-report in the categorie 'analysis' (Reportname in deutsch: modellversionen vergleichen) that use the versioning-component 'var compVersioning = Context.getComponent("Versioning");'
With the method 'getModelRevisions ( Model p_Model )' you get all versions of the model. but also such in the future (if you are logged in with a selected older db-version).
My interest is now, how can i get the db-version, the user is logged into the database respectively how can i get the model-version, the user startet the report from.
thanks for your help
Roman
Sorry, you are right, it seems I resigned too early on Eva Klein's reply.
The "db-version" is the Change List no. in Aris terms, which the user selects when logging into the database. The 2nd of 3 Aris Script Help entries for the Method openDatabaseVersion ( ..., int p_nVersionID ) on the Report class ArisData page gives an example on how to select a specific Change List no. when opening a versioned DB programmatically.
But I am afraid for your purpose there is missing a method like getSelectedChangeList() to retrieve the actual change list no. selected by the ActiveUser in order to find the model revision no.
Maybe you should add your question to Eva Klein's wish list
Hi,
var aModelRev = compVersioning.getModelRevisions(oModel);
The above returns number of versions of a corresponding model. So if I have 3 versions saved for a model, it shows correctly. But how do I open particular version of the Model in Script?
My requirement is to show version 1 of the model (objects and attributes) in one section of the report and version 2 in another section (assumption is each model will have only 2 versions)
Any ideas?
Cheers
Sankaran
This will get you the list of versions:
var database = ArisData.getActiveDatabase(); var versioning = Context.getComponent("Versioning"); var changeListInfo = versioning.getChangelistInfos(database);
This will open the first database version from changeListInfo:
var dbVersion = ArisData.openDatabaseVersion(database.Name(locale),changeListInfo[0]);
var g_nLoc = Context.getSelectedLanguage(); var oSelGroups = ArisData.getSelectedGroups(); for(var i=0; i<oSelGroups.length; i++){ var oModels = oSelGroups[i].ModelList(true); for(var j=0; j<oModels.length; j++){ var oModel = oModels[j]; var description = oModel.Attribute(Constants.AT_DESC,g_nLoc); description.setValue("Under review – not yet approved"); } } var database = ArisData.getActiveDatabase(); var versioning = Context.getComponent("Versioning"); var changeListInfo = versioning.getChangelistInfos(database); var dbVersion = ArisData.openDatabaseVersion(database.Name(locale),changeListInfofunction createHeader() { g_ooutfile.BeginTable(200, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); g_ooutfile.TableRow(); g_ooutfile.TableCell("Process ModelName", 50, "Arial", 10, Constants.C_WHITE, Constants.C_DARK_GREEN, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VCENTER, 0); g_ooutfile.TableCell("Description", 50, "Arial", 10, Constants.C_WHITE, Constants.C_DARK_GREEN, 0, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VCENTER, 0); g_ooutfile.TableRow() } } main();
Hi,
i dont understand what you want to do. If you would like to change the group where a mode has to be moved to, then you can use the Model-Method 'ChangeGroup(args)'. As argument you should use the Object of the new Group.
Hope that was you were looking for.
Regards,
Hi @all.
My intention is to create a kind of "version history" for a .doc report - a version history on model level, i.e. the report is started on a model.
I did the following:
var sModel = ArisData.getSelectedModels()[0]; var vcomponent = Context.getComponent("Versioning"); var rlist = vcomponent.getModelRevisions(sModel);
The "rlist" is an array of 2 versions - that's correct.... the method help says that the return value of the "getModelRevisions"-Method is of type "RevisionInfo[ ]".
How Can i fetch now further details to these two array items (versions)? Because the methods "getChangeListInfo()" or "getRevisionNumber() do not seem to work?
Hoping for some hints.
BR
Bernd
EDIT 25.08.2011:
Got it. As the return value is an array of model revisions, you have to execute the "getChangeListInfo()" to a single item in that array. Once you got the change list for one array item ( = one model revision), you can fetch user, id, description and timestamp.
for (var a=0; a<rlist.length; a++){ var rli = rlist[a].getChangeListInfo(); var rUser = rli.getUser(); var rStamp = rli.getSubmitTimeGMT0(); var rID = rli.getID(); var rDesc = rli.getDescription(); }
Hi Ravi:
Here is the code snippet,
var compVersioning = Context.getComponent("Versioning");
var aModelRev = compVersioning.getModelRevisions(p_aModel[i1]);
if (aModelRev.length != 0)
var sFirstRev = p_aModel[i1].Name(nLocale);
var secondRev = aModelRev[aModelRev.length-1].getChangeListInfo()