Page 1 of 1

Copy data from one element to another element in a single dimension

Posted: Wed Sep 21, 2016 7:18 am
by aravind.cgns
Hi Guys,

I have requirement where i have to copy data from one element to multiple other elements within a dimension. I have customer dimension and version dimension. I have to load data from my source customer to multiple target customers, similarly from source version to multiple target versions.I have a maximum of 50 target customers and 10 target versions. I am loading the data with customer and version combination. I have built lookup cube with pick list in order to pass parameters dynamically into my TI process.

Below Find My TI Code:

Prolog:

pSourceCustomer = CellGetS('Control Cube','p01','Customer Name');
pSourceVersion = CellGetS('Control Cube','p01','Version Type');

pTargetCustomer = CellGetS('Control Cube','p02','Customer Name');
pTargetVersion = CellGetS('Control Cube','p02','Version Type');

here for each parameter i am referring my lookup cube , is there any better way to optimize the TI Code to pull all the 50 parameters into my TI Process.

DATA :
IF( V3 @= pSourceCustomer & V2 @= pSourceVersion );
CellPutS(SValue,'General',V1,pTargetVersion,pTargetCustomer,V4);
ENDIF;
IF( V3 @= pSourceCustomer & V2 @= pSourceVersion );
CellPutN(NValue,'General',V1,pTargetVersion,pTargetCustomer,V4);
ENDIF;

Suggest me if there is a better way to change the TI Code.

Regards,
Arvind.

Re: Copy data from one element to another element in a single dimension

Posted: Wed Sep 21, 2016 11:54 am
by aravind.cgns
Guys,

In the above code which i have shared i am calling parameter every time from the lookup cube, i have a max of 50 Parameters, can we write a loop condition such that the parameter is dynamically passed in to the TI process from the lookup cube where user passes the parameters through pick-list.

Regards,
Arvind

Re: Copy data from one element to another element in a single dimension

Posted: Wed Sep 21, 2016 1:32 pm
by ardi
You Can use the EXPAND function

vDynamicVariableName = EXPAND( '%' | YOUR_EXPRESSION | '%' );

Re: Copy data from one element to another element in a single dimension

Posted: Thu Sep 22, 2016 8:02 am
by aravind.cgns
Thanks for the reply ardi, could you tell me in detail like how expand function works here in my case ?? Do i have to use any loop condition here?

Re: Copy data from one element to another element in a single dimension

Posted: Thu Sep 22, 2016 10:07 am
by BariAbdul
Hi Arvind,Please have a look at below link,It gives you good idea of expand function usage.

http://users.skynet.be/fa436118/wim/tm1 ... tII_EN.htm Thanks

Re: Copy data from one element to another element in a single dimension

Posted: Thu Sep 22, 2016 2:43 pm
by aravind.cgns
Hi Abdul,

I have altered my code as below:

Code in DATA tab :

i= 1;

while (i <=10);


pDim = 'p_Parameters';
pDim1 = 'p_Parameters_Version';

Param1 = Dimnm('pDim', i);
Param2 = Dimnm('pDim1',i);



pSourceCustomer = CellGetS('Test Customer Control Cube','Param1','Source Customer');


pTargetCustomer = CellGetS('Test Customer Control Cube','Param1','Target Customer');


pSourceVersion = CellGetS('Test Version Control Cube','Param2','Source Version');


pTargetVersion = CellGetS('Test Version Control Cube','Param2','Target Version');


IF( V3 @= pSourceCustomer & V2 @= pSourceVersion );
CellPutS(SValue,'Test_General',V1,pTargetVersion,pTargetCustomer,V4);
ENDIF;
IF( V3 @= pSourceCustomer & V2 @= pSourceVersion );
CellPutN(NValue,'Test_General',V1,pTargetVersion,pTargetCustomer,V4);
ENDIF;


i =i+1;

end;

in the above code it is unable to get the element from DIMNM function.

Guys,Provide any corrections needed in the above code

Re: Copy data from one element to another element in a single dimension

Posted: Thu Sep 22, 2016 2:54 pm
by ardi
I don't understand why you include your variable pDim and pDim1 in quotes.

From what i understand from your code, you have 2 dimensions, one called p_Parameters and the other one p_Parameters_Version and then in your while loop you are trying to get the first 10 elements for each??? when then use them as parameters???

Can you try this instead?
while (i <=10);


pDim = 'p_Parameters';
pDim1 = 'p_Parameters_Version';

Param1 = Dimnm(pDim, i);
Param2 = Dimnm(pDim1,i);



pSourceCustomer = CellGetS('Test Customer Control Cube',Param1,'Source Customer');


pTargetCustomer = CellGetS('Test Customer Control Cube',Param1,'Target Customer');


pSourceVersion = CellGetS('Test Version Control Cube',Param2,'Source Version');


pTargetVersion = CellGetS('Test Version Control Cube',Param2,'Target Version');


IF( V3 @= pSourceCustomer & V2 @= pSourceVersion );
CellPutS(SValue,'Test_General',V1,pTargetVersion,pTargetCustomer,V4);
ENDIF;
IF( V3 @= pSourceCustomer & V2 @= pSourceVersion );
CellPutN(NValue,'Test_General',V1,pTargetVersion,pTargetCustomer,V4);
ENDIF;


i =i+1;

end;

Re: Copy data from one element to another element in a single dimension

Posted: Fri Sep 23, 2016 12:13 pm
by aravind.cgns
Thanks ardi :D , now the process is working fine.