Flag is not updated

Post Reply
AnonimusMax
Posts: 60
Joined: Thu Nov 17, 2016 2:13 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Flag is not updated

Post by AnonimusMax »

Hi,

So i have a master process that runs 6 processes.( it is a process that is doing some calculations)
This process is triggered by a button, so more users can trigger this process in the same time.To avoid this situation, i created a flag. 0- when the process is not running end 1- if the process is started by another user.
So my master process when is called first checks is the flag =1, in this case processwquit; else updates the flag in the cube and runs the rest of the process and in the end updates the flag in 0 again.

This is the problem: when i update the flag in the begging with cellputn(); the flag is NOT updated in that moment. I can see the update in the cube after the 4th process has run.
I don t know what the problem is.As a solution i created a separate process that only checks the flag and is is 0 then it runs the master process, but again the update is done only after the 4 th process in the MASTER has finished. All the process from MASTER are placed in epilog, and for the first 4 i use EXECUTEPROCESS, and for the rest of 2 EXECUTECOMMAND.

Thank you,
User avatar
qml
MVP
Posts: 1097
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Flag is not updated

Post by qml »

Sorry the behaviour is not as you would expect it, but it is as intended. TI does not commit data changes immediately, but instead collects them in memory until the entire transaction (which might be a chain of TI processes) is done making changes and only then are they committed to the main model.

If you want to synchronise processes then you'll have to change your approach. You can e.g. use semaphores (search for "Serializing TurboIntegrator processes using synchronized") or flag objects external to TM1 (a file, a DB record, etc).
Kamil Arendt
User avatar
Elessar
Community Contributor
Posts: 413
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Flag is not updated

Post by Elessar »

Hi,

The process commits the the data entered (by CellPutN/S) after it finishes, even if the data was entered in the prolof tab. Before the process finishes, non you or the another process can see the changed data.

You can use, for example, a view as a flag (view is created or not).
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 10th article - AI has failed TM1 Quiz.
AnonimusMax
Posts: 60
Joined: Thu Nov 17, 2016 2:13 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Flag is not updated

Post by AnonimusMax »

Hi,

Thank you all for your replies.
So i solved my problem with a view. I create a empty View( createview) when the master process starts and if another user is trying to run the same thing, the process check s for the view and if the viewExistst the process quits.

Now i have the following problem. There are 2 reason why this button can trigger "process fail" alert:
1. There are incorrect parameters
2. Another user is running this process.
So how can I implement this message on the button, considering that I can t do it with a flag because it doesn t get updated in time.
I can t check in perspective if a view exists or not, so i don t have any ideea
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Flag is not updated

Post by tomok »

Action buttons come with a number of options and one of those options is to return a custom failure message when a TI process fails. That option is called "Show Failure Message". You can either hard code a message in the field or you can point the field to a range on your workbook, or even better utilize a TM1 function like DBR. With that in mind you can write your error message to a cube and then direct that field to the cube. something like this (with a two dimensional error cube):

In your TI:

Code: Select all

IF(ErrorConditionHere);
  CELLPUTS('The view already exists', 'ErrorCubeName', 'TI_Error_Msg', 'string');
ENDIF;
Then put this in the action button:

Code: Select all

DBR('ServerName:ErrorCubeName', 'TI_Error_msg', 'String');
When a user runs the TI and it encounters your error than a message box will pop up with the string returned from your DBR formula.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
AnonimusMax
Posts: 60
Joined: Thu Nov 17, 2016 2:13 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Flag is not updated

Post by AnonimusMax »

Hi Tomok,

I know the solution you have pointed out. I tryed it. The problem is that the flag is not updated on that moment.
It updated the message after a few minutes...Not on that exact moment. So if 2 users press the button 1 after another, the message will be wrong..

Thank you
lotsaram
MVP
Posts: 3704
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Flag is not updated

Post by lotsaram »

AnonimusMax wrote:Hi Tomok,

I know the solution you have pointed out. I tryed it. The problem is that the flag is not updated on that moment.
It updated the message after a few minutes...Not on that exact moment. So if 2 users press the button 1 after another, the message will be wrong..

Thank you
No. Just no.

Then simply put you did not implement Tomok's suggestion correctly.

You need to pay attention to the calculation properties of the action button to make sure the sheet refreshes AFTER the TI runs so the updated message retrieved from the DBR is displayed. (Also rather than cell reference it is also possible to enter DBR formula directly in the message text box.)

... and you would normally include client as dimension in he message cube in order to customise per user.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
AnonimusMax
Posts: 60
Joined: Thu Nov 17, 2016 2:13 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Flag is not updated

Post by AnonimusMax »

So i placed like this in the code:

IF(ViewExists(Cube,View)>0);
CELLPUTS('The view already exists', 'ErrorCubeName', 'TI_Error_Msg', 'string');
ENDIF;

and in the process fail message with DBR.
Maybe I am doing something wrong. But like this, is not working.
lotsaram
MVP
Posts: 3704
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Flag is not updated

Post by lotsaram »

AnonimusMax wrote:So i placed like this in the code:

IF(ViewExists(Cube,View)>0);
CELLPUTS('The view already exists', 'ErrorCubeName', 'TI_Error_Msg', 'string');
ENDIF;

and in the process fail message with DBR.
Maybe I am doing something wrong. But like this, is not working.
It's not about how the string in the cube is updated, it's about making sure the websheet is updated and retrieves the updated cube value after the process is run.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Post Reply