DT

Hi Everyone

This should presumably be pretty simple.

I've made some changes to a model as part of producing a printed report. Those changes are purely cosmetic so I'd like to discard the changes at various stages of my script execution.

I've set 

ArisData.Save(Constants.SAVE_ONDEMAND);

so that changes aren't automatically saved, but how do actually I tell the engine to discard them?

Thanks

Dan

by Nikita Martyanov
Posted on Thu, 02/15/2018 - 06:57

Hi Dan,

If you use SAVE_ONDEMAND mode, you won't get for example up-to-date model image or other information from database. All the changes you've done during report's working are in memory (in queue). So you have to save changes and then get up-to-date information from db.

I suppose there are two ways to change something, output it and discard changes:

1. Change something in db in normal save mode and do opposite operations to discard changes. Cons is that you will be saved as user who changed model.

2. Create temp model (copy of source) change it, output and delete. Cons is processor and memory load if your source data is big number of models.

BR, Nikita

0
by Dan Ternes Author
Posted on Fri, 02/16/2018 - 01:41

Ahhh, not so easy after all. 

Thanks a lot for the fast feedback.

0
by Nikita Martyanov
Posted on Fri, 02/16/2018 - 07:38

Hi Dan,

I've decided to check everything that I supposed and found out that I've made mistake. I was wrong, I'm sorry.

Everything is much more easy.

If you use SAVE_ONDEMAND mode, you can change everything and get changed information during report's working. Even images of models will contain all the attributes (names, for example) you change in session of report.

And all the changes you've done in this mode won't get to database. So you can use modified information only in session of report. And you don't need to discard any changes in this mode.

BR, Nikita

0
by Dan Ternes Author
Posted on Tue, 02/20/2018 - 07:40

In reply to by billie1989

Hi Nikita,

it was very nice of you to look into it further. 

I need to be a bit more precise with my requirements. I want to modify a model in memory during script execution, and add an image of the modified model to my report. Then discard those first changes, make a second lot of changes, and add the second image to my report also. Then the script execution finishes and the model returns to its pristine state. 

Its the discarding of the first lot of changes that I’d like to accomplish. 

Cheers

Dan

0
by Nikita Martyanov
Posted on Tue, 02/20/2018 - 08:16

Hi Dan,

now it's clear. Use method refreshObjects of database after the first model graphic will be output. This method refreshes objects in memory reading data from database .

BR, Nikita

0
by Dan Ternes Author
Posted on Thu, 02/22/2018 - 03:08

Thanks Nikita. That was the simple command I was looking for.

Unfortunately, it doesn't have any effect. I refreshed the model and the objects in the model, but nothing changes.

:-(

0
by Nikita Martyanov
Posted on Thu, 02/22/2018 - 06:39

In reply to by dternes

Hi Dan,

Nevertheless it works.

Here is piece of code.

ArisData.Save(Constants.SAVE_ONDEMAND);
var db = ArisData.getActiveDatabase()
var model = ArisData.getSelectedModels()[0]
var loc = Context.getSelectedLanguage()
var oOutput = Context.createOutputObject()

model.Attribute(Constants.AT_NAME,loc).setValue("ModelName")
model.ObjOccList()[0].ObjDef().Attribute(Constants.AT_NAME,loc).setValue("ObjectName")
//model.ObjOccList()[0].ObjDef().Attribute(Constants.AT_NAME,loc).getValue()
oOutput.BeginSection(297, 210, 12, 12, 25, 15, 20, 20, false, Constants.SECTION_DEFAULT)
//output changed model
oOutput.OutGraphic(model.Graphic(false,false,loc), -1, oOutput.getCurrentMaxWidth(), oOutput.GetPageHeight() - oOutput.GetTopMargin() - oOutput.GetBottomMargin() -32);
db.refreshObjects(null,false)//refresh all the objects
//output model without any changes
oOutput.OutGraphic(model.Graphic(false,false,loc), -1, oOutput.getCurrentMaxWidth(), oOutput.GetPageHeight() - oOutput.GetTopMargin() - oOutput.GetBottomMargin() -32);
oOutput.EndSection()
oOutput.WriteReport()
0
by Dan Ternes Author
Posted on Thu, 02/22/2018 - 08:53

Can I ask what ARIS version you're running? I'm on 10.0.0.2.

Your code throws the following error in my environment

-------------------

Exception in file, line 0:

An error occurred in the report object model, error running Database.refreshObjectsf) failed.

-------------------

I came across this last night with my script code. My ARIS version won't accept null as the first parameter to the refreshObjects call and so throws that error. Instead, you have to supply an ArisObject[] array.

So I called refreshObjects() twice; once with an array of models and a second time with an array of objOccs. In both cases, the report is produced without undoing the attribute change. See attached. I get the same results in my code.

The fact that refreshObjects() throws the error with null probably means it's not the only gremlin in the API call and that's why I'm not getting the refreshed view of the model.

But thanks so much for your help on this. It's really appreciated.

File attachments
0
by Nikita Martyanov
Posted on Thu, 02/22/2018 - 09:48

In reply to by dternes

My version is 7.2.

I think you need ask Software AG through empower ticket or wait when they answer here.

BR, Nikita

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