How to re-use the data from source twice?

Post Reply
Ashleigh W
Posts: 28
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

How to re-use the data from source twice?

Post by Ashleigh W » Tue Oct 10, 2017 9:01 am

Hi, I have set up data source in pro-log which is working as expected, now when it comes to data tab I want to be able to go through this data twice, this is because I want to process this condition for all true first and all false item in second time. I know we can create another ti process to process true first and false second, but we can eliminate this step if there is a way to loop though this source data twice.

please advice.
Thank you

User avatar
qml
MVP
Posts: 1042
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: How to re-use the data from source twice?

Post by qml » Tue Oct 10, 2017 9:54 am

TM1 has a built-in mechanism to loop through the source data twice already - that's what the Metadata and Data tabs are for. And you can manipulate data on the Metadata tab - there are no rules against that.

Having said that, why can't you execute the condition separately for each record? I can't think of a common scenario where going through your data source more than once would be required for algorithmic reasons.
Kamil Arendt

ascheevel
Posts: 5
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: 11.2
Excel Version: 2016

Re: How to re-use the data from source twice?

Post by ascheevel » Tue Oct 10, 2017 12:12 pm

I agree with qml that there might be a better solution that doesn't involve spinning through the datasource twice, but if you're set on it, you could always run the process twice and use a parameter and if statement to segregate operations between first and second run. You can call the second run from the epilog tab. The example code below assumes the process has a parameter called pRerun and the default value is set to zero.

Prolog tab:

Code: Select all

pRerun = pRerun + 1;
Data tab:

Code: Select all

IF(pRerun = 1);
#	do stuff here that you want to do on the first run for all true stuff
ELSEIF(pRerun = 2);
#	do stuff here that you want to do on the second run for all false stuff
ENDIF;
Epilog tab:

Code: Select all

# IF statement prevents process from calling itself ad infinitum
IF(pRerun = 1);
	ExecuteProcess('SomeProcess', 'pRerun',pRerun);
ENDIF;

Ashleigh W
Posts: 28
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: How to re-use the data from source twice?

Post by Ashleigh W » Tue Oct 10, 2017 2:24 pm

This is helpful. thank you for your help.

Post Reply