Page 1 of 1

fileexists and dimensionexists

Posted: Wed Sep 20, 2017 9:16 am
by raman
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.

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 9:20 am
by Edward Stuart
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

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 10:20 am
by raman
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;

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 11:30 am
by BariAbdul
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

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 12:04 pm
by raman
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

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 12:08 pm
by tomok
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.

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 12:23 pm
by raman
can you suggest if file is missing i have to exit the process with a message, how to do that

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 1:33 pm
by Wim Gielis
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.

Re: fileexists and dimensionexists

Posted: Wed Sep 20, 2017 1:40 pm
by BariAbdul
You could get further info regarding LogOutput here:
https://everanalytics.wordpress.com/201 ... ognos-tm1/ Thanks