JD

Dear Community,

I'm trying to copy LaneAttributeModellingProperties from one lane to another, but after execution of the code listed below, error message appears: "Error during script execution: Lane.setLaneAttributeModellingProperties", with no further explanation.

What is wrong here? Unfortunately there is almost no documentation on setting LaneAttributeModellingProperties and time dependant models. (ARIS 7.2).

<code>

function main(){

    

    var locale = Context.getSelectedLanguage();

    var database = ArisData.getActiveDatabase();

    var template_model_GUID = "9d63eb10-****-11e7-576e-0a0027000000";

    var newModel_group_GUID = "731b9760-****-11e7-576e-0a0027000000";

    var template_model = database.FindGUID(template_model_GUID);

    var template_lane = template_model.GetLanes(Constants.LANE_VERTICAL)[0];

    var template_laneProperties = template_lane.getLaneAttributeModellingProperties();

    //create new model

    var group = database.FindGUID(newModel_group_GUID);

    var newModel = group.CreateModel(Constants.MT_PROJECT_SCHEDULE, "Roadmap", locale);

    

    //delete any horizontal or vertical lanes in the new model (because they are created automatically in previous step)

    var horizontalLanes = newModel.GetLanes(Constants.LANE_HORIZONTAL);

    for (var h in horizontalLanes){

        newModel.deleteLane(horizontalLanes[h]);

    }

    var verticalLanes = newModel.GetLanes(Constants.LANE_VERTICAL);

    for (var v in verticalLanes){

        newModel.deleteLane(verticalLanes[v]);

    }

    

    //create single new lane and setLaneAttributeModellingProperties

    var newLane = newModel.createLane(9999,Constants.LANE_VERTICAL);

    newLane.setLaneAttributeModellingProperties(template_laneProperties,true);

}

main();



</code>

Greetings,

Jacek

by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Thu, 06/01/2017 - 12:40

Hi Jacek,

have you checked if the newLane is valid ?   Meaning has the script created the lane ?   Otherwise I would try to only set the lane properties to an existing lane instead of deleting all lanes...

Or you could just make a model copy via the merge component - then you have everything exactly the same...

BR Robert

0
by Jacek Domon Author
Posted on Thu, 06/01/2017 - 17:00

Robert,

Thank you for fast answer!

Yes, the lane is created during script execution. It even has it's LaneAttributeModellingProperties available for me right after creation. So I tried to set some properties on it:

    // let's create new lane and get it's LaneAttributeModellingProperties

    var newLane = newModel.createLane(9999,Constants.LANE_VERTICAL);

    var laneProperties = newLane.getLaneAttributeModellingProperties();

    

    // let's set some properties on the LaneAttributeModellingProperties

    laneProperties.addAttributeDependentSymbols(Constants.ST_PROJECT,true,true);

    laneProperties.setDimensionATN(Constants.AT_START_DATE);

    laneProperties.setLabelingStyle(Constants.CONCRETE_DATE_STYLE);

    laneProperties.setMajorInterval(Constants.CONCRETE_DATE_GRID_YEARS);

    laneProperties.setMinorInterval(Constants.CONCRETE_DATE_GRID_WEEKS);

    laneProperties.setModelingSpacePerAttributeValue(6);

    laneProperties.setPositionATN(Constants.AT_TRANS_DUR);

    laneProperties.setStartValue(new Date().getTime());

    laneProperties.setEndValue(1527860711825);

    

The commands above seem to work, at least I can check it by using for example laneProperties.getEndValue(). But they have no effect on the model itself. It opens with blank lane and no timeline is displayed.

and here are the properties of the lane (polish labels but it does not matter):

and if at the end of script I use:

    newLane.setLaneAttributeModellingProperties(laneProperties);

this still produces same error like in the initial post.

In other words, I would like to:

1. Create a new model (Project Schedule type).

2. Create a new vertical lane in it

3. Assign specific LaneAttributeModellingProperties to that lane

4. At the end the model when opened, should display the lane with timeline which parameters are based on the LaneAttributeModellingProperties above.    

So it should be like this:

Is it any way to do it? Missed something maybe?

Regards,

Jacek

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Fri, 06/02/2017 - 09:18

Ahm ok, you get a complete class by this commando LaneAttributeModellingProperties 

So you have to get the single properties and set them one by one to the new lane:

laneProperties.getEndValue ( )  => newLane.getLaneAttributeModellingProperties().setEndValue ( long newEndValue )

laneProperties.getStartValue ( )   => newLane.getLaneAttributeModellingProperties().setStartValue ( long newStartValue )

etc.

BR Robert

0
by Jacek Domon Author
Posted on Fri, 06/02/2017 - 11:37

Thank you Robert,

I have tried to change my script according to your solution, but I can't force the timeline to be displayed.

This is my code:

function main(){

       

    var locale = Context.getSelectedLanguage();

    var database = ArisData.getActiveDatabase();

    var newModel_group_GUID = "731b9760-****-11e7-576e-0a0027000000"; // please replace with any GUID of group from your local database

    var group = database.FindGUID(newModel_group_GUID);

    //create new model

    var newModel = group.CreateModel(Constants.MT_PROJECT_SCHEDULE, "Roadmap", locale);

       

    //create new vertical lane

    var newLane = newModel.createLane(9999,Constants.LANE_VERTICAL);

    newLane.getLaneAttributeModellingProperties().setStartValue(1496393532247);    

    newLane.getLaneAttributeModellingProperties().setEndValue(1514674800000);

    newLane.getLaneAttributeModellingProperties().setPositionATN(Constants.AT_START_DATE);

    newLane.getLaneAttributeModellingProperties().setDimensionATN(Constants.AT_TRANS_DUR);

    newLane.getLaneAttributeModellingProperties().setLabelingStyle(Constants.CONCRETE_DATE_STYLE);

    newLane.getLaneAttributeModellingProperties().setMajorInterval(Constants.CONCRETE_DATE_GRID_YEARS);

    newLane.getLaneAttributeModellingProperties().setMinorInterval(Constants.CONCRETE_DATE_GRID_WEEKS);

    newLane.getLaneAttributeModellingProperties().addAttributeDependentSymbols(Constants.ST_PROJECT,true,true);

    newLane.getLaneAttributeModellingProperties().setModelingSpacePerAttributeValue(0.6000000238418579);   

    //this horizontal lane below is created just in case

    newModel.createLane(138,Constants.LANE_HORIZONTAL);

}

main();

If you could please run this script in your environment and check if it works (timeline displayed on the model)? I really can't figure out what is wrong here.

BR Jacek

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Fri, 06/02/2017 - 13:06

Hi Jacek,

ahm well, one should always take more care when assessing the help. There is a command for lanes:

setLaneAttributeModellingProperties LaneAttributeModellingProperties newPropertySet )

Which is not the same as you did...  But before you ask, I also do not know how to create such a property set. So my best bet would be to get an existing one from the other lanes (which has to be checked that it is not null), change it and then try to set it to the new lane.

And by the way - if you create a new model, it already has some lanes. I am a little bit confused why, but some of those lanes return a null when doing this:

getLaneAttributeModellingProperties ( )   => the current attributebased modeling properties of the given lane or null if the lane can not be configured for attribute based modelling (not all lanes types are supported)

So it is possible that some lanes are just not allowed to set those modelling properties...

BR Robert

0
by Jacek Domon Author
Posted on Fri, 06/02/2017 - 15:34

Robert,

thank you for your help in this case again.

This was my initial try: because I didn't know how to setup the property set, I tried to copy it directly from another model using setLaneAttributeModellingProperties, but... there was an error while I was trying to do this.

It is true that some lanes are not allowed to set the modelling properties, but I carefully looked at the lane.TypeNum() from the model that displayed timeline properly, and used it's value: 9999 in my new lane. I assume that this type of lane should be valid for setting LaneAttributeModellingProperties.

For me it seems like there is some sort of a bug in this method (setLaneAttributeModellingProperties), maybe it is rarely used and there is no one who encountered this issue previously...

OR I don't know how to apply it to the Lane properly, but saddly there are no examples of proper use anywhere.

BR!

Jacek

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