fileexists and dimensionexists

Post Reply
raman
Posts: 10
Joined: Mon Sep 18, 2017 9:12 am
OLAP Product: tm1
Version: 10.2.2
Excel Version: 2010

fileexists and dimensionexists

Post by raman » Wed Sep 20, 2017 9:16 am

i am new to tm1. i want to make a ti process which first check wether the file exists or not, if fileexists then process should continue otherwise it should exit with a suitable message.then it should check for dimension and create or update according to availability of dimension.

Edward Stuart
Community Contributor
Posts: 191
Joined: Tue Nov 01, 2011 10:31 am
OLAP Product: TM1
Version: All
Excel Version: All
Location: Manchester

Re: fileexists and dimensionexists

Post by Edward Stuart » Wed Sep 20, 2017 9:20 am

What have you tried so far?

Have you seen the request for assistance guidelines

Have you tried googling for any information?

https://www.google.co.uk/search?q=cogno ... e&ie=UTF-8

raman
Posts: 10
Joined: Mon Sep 18, 2017 9:12 am
OLAP Product: tm1
Version: 10.2.2
Excel Version: 2010

Re: fileexists and dimensionexists

Post by raman » Wed Sep 20, 2017 10:20 am

i tried this
if(FileExists('filename')=1);
ExecuteProcess('dim_name');
else;
ProcessQuit;
endif;
but this one is sending the process into loop


and for dimension part i did

if(dimesnionexists('dim_name')=0);
dimensioncreate('dim_name');
else;
dimensionupdatedirect('dim_name');
endif;

BariAbdul
Regular Participant
Posts: 403
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: TM1,Cognos
Version: 9.5.2
Excel Version: 2007

Re: fileexists and dimensionexists

Post by BariAbdul » Wed Sep 20, 2017 11:30 am

Have you defined the path correctly in the TI :

FileExists('C:\tm1s7\pdata\model.dim');

And created a wapper process to perform the evaluation in the PROLOG:

IF(FileExists('FILENAME') =1);
ExecuteProcess('Load Process Name Here');
ELSE;
ProcessQuit;
ENDIF;

As for the second part:
This feature can be used extensively after direct dimensioning with DimensionElementInsertDirect, DimensionElementDeleteDirect, DimensionElementComponentAddDirect, DimensionElementComponentDeleteDirect and / or DimensionTopElementInsertDirect. Calling the DimensionUpdateDirect function causes the entire memory to start consuming, but can be used to ensure that the dimension is the smallest possible impression of the memory when the processing is completed.
Thanks
"You Never Fail Until You Stop Trying......"

raman
Posts: 10
Joined: Mon Sep 18, 2017 9:12 am
OLAP Product: tm1
Version: 10.2.2
Excel Version: 2010

Re: fileexists and dimensionexists

Post by raman » Wed Sep 20, 2017 12:04 pm

BariAbdul wrote:
Wed Sep 20, 2017 11:30 am
Have you defined the path correctly in the TI :

FileExists('C:\tm1s7\pdata\model.dim');

And created a wapper process to perform the evaluation in the PROLOG:

IF(FileExists('FILENAME') =1);
ExecuteProcess('Load Process Name Here');
ELSE;
ProcessQuit;
ENDIF;

As for the second part:
This feature can be used extensively after direct dimensioning with DimensionElementInsertDirect, DimensionElementDeleteDirect, DimensionElementComponentAddDirect, DimensionElementComponentDeleteDirect and / or DimensionTopElementInsertDirect. Calling the DimensionUpdateDirect function causes the entire memory to start consuming, but can be used to ensure that the dimension is the smallest possible impression of the memory when the processing is completed.
Thanks
so i have to create two processes for fileexists to work ,please tell if there is some way i can do in single process
and can i use a if within a if in ti

User avatar
tomok
MVP
Posts: 2335
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: fileexists and dimensionexists

Post by tomok » Wed Sep 20, 2017 12:08 pm

raman wrote:
Wed Sep 20, 2017 10:20 am
i tried this
if(FileExists('filename')=1);
ExecuteProcess('dim_name');
else;
ProcessQuit;
endif;
but this one is sending the process into loop
No, it isn't sending your process into a loop as you do not have any looping code, i.e., no WHILE statement. What you cannot do is use this logic in the Data tab, it must be in the Prolog. Yes, it is technically possible to do a FileExists in the Data tab but not with the logic you are using.

raman
Posts: 10
Joined: Mon Sep 18, 2017 9:12 am
OLAP Product: tm1
Version: 10.2.2
Excel Version: 2010

Re: fileexists and dimensionexists

Post by raman » Wed Sep 20, 2017 12:23 pm

can you suggest if file is missing i have to exit the process with a message, how to do that

Wim Gielis
MVP
Posts: 1538
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1
Version: PAL 2.0
Excel Version: 2016
Location: Brussels, Belgium
Contact:

Re: fileexists and dimensionexists

Post by Wim Gielis » Wed Sep 20, 2017 1:33 pm

One option is:

Above the ProcessQuit, add a line with the LogOutput function. Then you get the message you want in the message log. If you want to have the messsage in a different way, please give more context.
Best regards,

Wim Gielis

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 103 TM1 articles and a lot of custom code
Newest blog article: TM1 message log analysis with Power Query

BariAbdul
Regular Participant
Posts: 403
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: TM1,Cognos
Version: 9.5.2
Excel Version: 2007

Re: fileexists and dimensionexists

Post by BariAbdul » Wed Sep 20, 2017 1:40 pm

You could get further info regarding LogOutput here:
https://everanalytics.wordpress.com/201 ... ognos-tm1/ Thanks
"You Never Fail Until You Stop Trying......"

Post Reply