Numeric values not copying from source to target elaments
- Steve Rowe
- Site Admin
- Posts: 2464
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: Numeric values not copying from source to target elaments
Hi Abdul,
Suggest you apply a liberal sprinkling of asciioutput commands to your code so that you can debug it and understand where it is going wrong.
With the complexity of the code in your TI and no knowledge of all the structures that are being tested against it is pretty difficult for anyone else to debug.
Cheers,
Suggest you apply a liberal sprinkling of asciioutput commands to your code so that you can debug it and understand where it is going wrong.
With the complexity of the code in your TI and no knowledge of all the structures that are being tested against it is pretty difficult for anyone else to debug.
Cheers,
Technical Director
www.infocat.co.uk
www.infocat.co.uk
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Numeric values not copying from source to target elaments
Pricelessaravind.cgns wrote:Abdul,

@Aravind.cgns: do you have the habit to use AsciiOutput to debug your TI processes ?
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Community Contributor
- Posts: 296
- Joined: Tue Sep 06, 2016 7:55 am
- OLAP Product: TM1
- Version: 10.1.1
- Excel Version: Excel 2010
Re: Numeric values not copying from source to target elaments
Just for my benefit why weren't the numeric values being populated?
regards, Mark (not Abdul)
regards, Mark (not Abdul)
- 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: Numeric values not copying from source to target elaments
Hi Abdul,Steve Rowe wrote:Suggest you apply a liberal sprinkling of asciioutput commands to your code so that you can debug it and understand where it is going wrong.
That is what I suggested some 15 posts ago, but it doesn't seem to have struck a chord.
Kamil Arendt
-
- MVP
- Posts: 264
- Joined: Mon Nov 03, 2014 8:23 pm
- OLAP Product: TM1
- Version: 9.5.2 10.1 10.2 PA2
- Excel Version: 2016
Re: Numeric values not copying from source to target elaments
I prefer using LogOutput over AsciiOuput. I can then leave the debug statements in the code all the time and only enable the logging as needed via the tm1s-log.properties file.
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
Thanks for the replies,
Guys i am using AsciiOuput in my code, when i am trying to execute the subsetelementinsert() with loop variable passing into it , it displays the below error:
Error: Prolog procedure line (380): Unable to insert element "-1" in dimension:subset "Hier Customer:Target View". Position of element exceeds the number of elements in subset + 1.
i am including part of the code where i am encountering the error:
### Determine Cube Substitution ###
m = 1;
while(m<=20);
pDim2 = 'p_Parameters_Cube';
Param3 = Dimnm(pDim2,m);
pCube = CellGetS('Test Control Finance Cube',Param3,'Cube Name');
If( pCube @= '' );
Break;
EndIf;
### Determine Customer dimension Substitution ###
i= 1;
while (i <=50);
pDim = 'p_Parameters';
Param1 = Dimnm(pDim, i);
pSourceCustomer = CellGetS('Test Customer Control Cube',Param1,'Source Customer');
pTargetCustomer = CellGetS('Test Customer Control Cube',Param1,'Target Customer');
### Break the loop if any of the source or target customer not found ###
If( pSourceCustomer @= '' % pTargetCustomer @= '');
Break;
EndIf;
### Determine version dimension Substitution ###
k =1;
while(k<=10);
pDim1 = 'p_Parameters_Version';
Param2 = Dimnm(pDim1,k);
pSourceVersion = CellGetS('Test Version Control Cube',Param2,'Source Version');
pTargetVersion = CellGetS('Test Version Control Cube',Param2,'Target Version');
### Break the loop if any of the source or target version not found ###
If( pSourceVersion @= '' % pTargetVersion @='' );
Break;
EndIf;
.
.
.
.
.
.
.
After the debug checks and paramer validation error occurs in below part of the code:
cTempViewFrom = cViewSource;
cTempSubFrom = cTempViewFrom;
If( ViewExists( pCube, cTempViewFrom ) = 1 );
ViewDestroy( pCube, cTempViewFrom );
EndIf;
ViewCreate( pCube, cTempViewFrom );
If( SubsetExists( pDimension, cTempSubFrom ) = 1 );
SubsetDeleteAllElements( pDimension, cTempSubFrom );
Else;
SubsetCreate( pDimension, cTempSubFrom );
EndIf;
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, i );-----(Error occurs here)
ViewSubsetAssign( pCube, cTempViewFrom, pDimension, cTempSubFrom );
please suggest me like how to overcome this error
Guys i am using AsciiOuput in my code, when i am trying to execute the subsetelementinsert() with loop variable passing into it , it displays the below error:
Error: Prolog procedure line (380): Unable to insert element "-1" in dimension:subset "Hier Customer:Target View". Position of element exceeds the number of elements in subset + 1.
i am including part of the code where i am encountering the error:
### Determine Cube Substitution ###
m = 1;
while(m<=20);
pDim2 = 'p_Parameters_Cube';
Param3 = Dimnm(pDim2,m);
pCube = CellGetS('Test Control Finance Cube',Param3,'Cube Name');
If( pCube @= '' );
Break;
EndIf;
### Determine Customer dimension Substitution ###
i= 1;
while (i <=50);
pDim = 'p_Parameters';
Param1 = Dimnm(pDim, i);
pSourceCustomer = CellGetS('Test Customer Control Cube',Param1,'Source Customer');
pTargetCustomer = CellGetS('Test Customer Control Cube',Param1,'Target Customer');
### Break the loop if any of the source or target customer not found ###
If( pSourceCustomer @= '' % pTargetCustomer @= '');
Break;
EndIf;
### Determine version dimension Substitution ###
k =1;
while(k<=10);
pDim1 = 'p_Parameters_Version';
Param2 = Dimnm(pDim1,k);
pSourceVersion = CellGetS('Test Version Control Cube',Param2,'Source Version');
pTargetVersion = CellGetS('Test Version Control Cube',Param2,'Target Version');
### Break the loop if any of the source or target version not found ###
If( pSourceVersion @= '' % pTargetVersion @='' );
Break;
EndIf;
.
.
.
.
.
.
.
After the debug checks and paramer validation error occurs in below part of the code:
cTempViewFrom = cViewSource;
cTempSubFrom = cTempViewFrom;
If( ViewExists( pCube, cTempViewFrom ) = 1 );
ViewDestroy( pCube, cTempViewFrom );
EndIf;
ViewCreate( pCube, cTempViewFrom );
If( SubsetExists( pDimension, cTempSubFrom ) = 1 );
SubsetDeleteAllElements( pDimension, cTempSubFrom );
Else;
SubsetCreate( pDimension, cTempSubFrom );
EndIf;
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, i );-----(Error occurs here)
ViewSubsetAssign( pCube, cTempViewFrom, pDimension, cTempSubFrom );
please suggest me like how to overcome this error
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: Numeric values not copying from source to target elaments
Change
To
Code: Select all
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, i );
Code: Select all
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, SubsetGetSize ( pDimension, cTempSubFrom) + 1 );
[/code
The issue is that "i" inrements every time but the subset size doesnt; so if the first element you tried to add is the 10th tested it was trying to add it into the 10th position in an empty subset... you could also just always use position 1 in the subset assume you don't care about the order.
Edit - just noticed that it looks from your code as if you are destroying the subset for every increment anyway - so you would only ever have 1 element in the subset at a time? If so just use 1.
Declan Rodger
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
Thanks for the reply declanr, i have changed the code as u suggested.
Below are my two control cubes which has two control cubes one for customer other for version:
Source Customer Target Customer Source Version Target Version
CSCHEST0000 CSCHEST0000 Version 1 Version 2
GIANTCAR000 GIANTCAR000 Current Version 3
after changing the code still i have only one element included in my subsets :
from source view customer subset it is inserting last element 'GIANTCAR000'
from Target view customer subset it is inserting last element 'GIANTCAR000'
from source view version subset it is inserting last element 'Current'
from source view version subset it is inserting last element 'Version 3'
it is doing one to one mapping where i need many to many mapping.It is unable to insert all the elements selected from the control cubes.
Below are my two control cubes which has two control cubes one for customer other for version:
Source Customer Target Customer Source Version Target Version
CSCHEST0000 CSCHEST0000 Version 1 Version 2
GIANTCAR000 GIANTCAR000 Current Version 3
after changing the code still i have only one element included in my subsets :
from source view customer subset it is inserting last element 'GIANTCAR000'
from Target view customer subset it is inserting last element 'GIANTCAR000'
from source view version subset it is inserting last element 'Current'
from source view version subset it is inserting last element 'Version 3'
it is doing one to one mapping where i need many to many mapping.It is unable to insert all the elements selected from the control cubes.
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Numeric values not copying from source to target elaments
I prefer a 0:declanr wrote:ChangeToCode: Select all
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, i );
The issue is that "i" inrements every time but the subset size doesnt; so if the first element you tried to add is the 10th tested it was trying to add it into the 10th position in an empty subset... you could also just always use position 1 in the subset assume you don't care about the order.Code: Select all
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, SubsetGetSize ( pDimension, cTempSubFrom) + 1 );
Edit - just noticed that it looks from your code as if you are destroying the subset for every increment anyway - so you would only ever have 1 element in the subset at a time? If so just use 1.
Code: Select all
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, 0 );
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
wim, I have used the logic u have suggested but still it is unable to create subset with all the elements selected from control cubes.
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: Numeric values not copying from source to target elaments
This section:aravind.cgns wrote:wim, I have used the logic u have suggested but still it is unable to create subset with all the elements selected from control cubes.
Code: Select all
If( SubsetExists( pDimension, cTempSubFrom ) = 1 );
SubsetDeleteAllElements( pDimension, cTempSubFrom );
Else;
SubsetCreate( pDimension, cTempSubFrom );
EndIf;
Declan Rodger
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Numeric values not copying from source to target elaments
... That's why you should use AsciiOutput, like e.g. in:
and so on. Thát is debugging. Put the statement before and after and compare both results.
AFTER should be 1 higher than BEFORE.
Also, BEFORE should probably not be 0 (only in the first instance of the loop). Afterwards it should increment like 0, 1, 2, 3, ..., you get the picture (hopefully).
Code: Select all
AsciiOutput( 'test.txt', 'BEFORE', NumberToString( SubsetGetSize( pDimension, cTempSubFrom )));
SubsetElementInsert( pDimension, cTempSubFrom, pSourceCustomer, 0 );
AsciiOutput( 'test.txt', 'AFTER', NumberToString( SubsetGetSize( pDimension, cTempSubFrom )));
AFTER should be 1 higher than BEFORE.
Also, BEFORE should probably not be 0 (only in the first instance of the loop). Afterwards it should increment like 0, 1, 2, 3, ..., you get the picture (hopefully).
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
thanks declar, it worked well when i have created subset and view before the loop and inserted the elements inside the loop, but it is creating a duplicate value for each element
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Numeric values not copying from source to target elaments
That's logical, since you are allowed to add the same element multiple times in the same subset. Just as you could do that manually.aravind.cgns wrote:thanks declar, it worked well when i have created subset and view before the loop and inserted the elements inside the loop, but it is creating a duplicate value for each element
Possible solutions include:
- populate a temporary dimension first, dimensions can only hold unique elements, after which you transfer the dimension elements to a subset in your main dimension
- when inserting an element in a subset, loop over the current subset elements to see if the element already exists in the subset, or not
- just before using your subset after it is filled, loop over it and delete the duplicate elements from the subset
- other
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
i am not sure like due to the above duplicate elements in subset data is not correctly populating into target cells!!!
Source Customer Target Customer
CSCHEST0000 CSCHEST0000
Source Version Target Version
CURRENT VERSION 1
VERSION 2 VERSION 4
it is copying data from version 2 to both the target versions version 1 and version 4 instead it should copy data from current to version 1 and version 2 to version 4. please look into my attachment and suggest me like my data procedure is writing data correctly into target cells.
Source Customer Target Customer
CSCHEST0000 CSCHEST0000
Source Version Target Version
CURRENT VERSION 1
VERSION 2 VERSION 4
it is copying data from version 2 to both the target versions version 1 and version 4 instead it should copy data from current to version 1 and version 2 to version 4. please look into my attachment and suggest me like my data procedure is writing data correctly into target cells.
- Attachments
-
- TI Process.docx
- (38.13 KiB) Downloaded 440 times
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Numeric values not copying from source to target elaments
Aravind.cgns,aravind.cgns wrote:i am not sure like due to the above duplicate elements in subset data is not correctly populating into target cells!!!
Source Customer Target Customer
CSCHEST0000 CSCHEST0000
Source Version Target Version
CURRENT VERSION 1
VERSION 2 VERSION 4
it is copying data from version 2 to both the target versions version 1 and version 4 instead it should copy data from current to version 1 and version 2 to version 4. please look into my attachment and suggest me like my data procedure is writing data correctly into target cells.
Please FIRST think about a solution and your cubes, THEN implement it in TI. Not the other way round.
Trial and error is also not the best approach.
Your solution SHOULD look like this:
1. Create a cube with 2 dimensions:
- a linenumber dimension, elements 1 to 20, say
- a measures dimension containing elements Year_Source, Year_Target, Scenario_Source, Scenario_Target, Version_Source, Version_Target, ...
All String elements, it could be picklists. The way you populate the cube is irrelevant, be it rules, TI, someone typing in the element names, it's unimportant as long as the cells contain valid element names in the dimensions
2. Create a TI process that loops over the linenumber dimension. As simple as that !
Check in the relevant dimensions that the input of the user exists.
Within the loop, do ExecuteProcess to the next process
3. Create the process that copies data, again very simple and straightforward.
It's part of what you already have.
Create parameters for Year_Source, Year_Target, Scenario_Source, and so on.
This is the way in which probably every decent TM1 developer would approach this problem.
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
Thanks wim for the faster response , could you please explain in detail like how the TI process works with execute process, currently i am using 3 different control cubes for cube names , customers and versions.
If i understood correctly you have suggested like to create a single cube to hold all these inputs from control cubes in a single measure dimension ???
help me out to write the TI process i am new to TM1!!! suggest me a sample process i will build my own.
Thanks,
Aravind
If i understood correctly you have suggested like to create a single cube to hold all these inputs from control cubes in a single measure dimension ???
help me out to write the TI process i am new to TM1!!! suggest me a sample process i will build my own.
Thanks,
Aravind
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
wim,
i am able to get all the parameters from the control cubes using loops, the problem is with my data copy logic it has work with combination of customer and version input parameters, i have 20 different cubes where i have to copy the data with the same input parameters, so challenge here is each cube has different number of dimensions. so my cellputs or cellputn should work in such a way that it correctly pick the input parameters.
suggest me like anything to be altered in my data procedure in the attached document.
i am able to get all the parameters from the control cubes using loops, the problem is with my data copy logic it has work with combination of customer and version input parameters, i have 20 different cubes where i have to copy the data with the same input parameters, so challenge here is each cube has different number of dimensions. so my cellputs or cellputn should work in such a way that it correctly pick the input parameters.
suggest me like anything to be altered in my data procedure in the attached document.
- Attachments
-
- TI Process.docx
- (38.13 KiB) Downloaded 486 times
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Numeric values not copying from source to target elaments
In the OP you mention that you have Bedrock processes, so why not use such generic processes to copy data ?aravind.cgns wrote:wim,
i am able to get all the parameters from the control cubes using loops, the problem is with my data copy logic it has work with combination of customer and version input parameters, i have 20 different cubes where i have to copy the data with the same input parameters, so challenge here is each cube has different number of dimensions. so my cellputs or cellputn should work in such a way that it correctly pick the input parameters.
IIRC Bedrock has processes to copy data when the number of dimensions in the cube is variable.
Such process will then be executed with ExecuteProcess and the correct parameters, within loops over a single control cube (with measures where the user enters his choices).
If you're new to TM1 this will certainly not be easy and I would advise to hire someone with TM1 knowledge for a short period of time to set this up.
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 51
- Joined: Sun Sep 11, 2016 1:55 pm
- OLAP Product: Cognos Tm1
- Version: 10.2,11
- Excel Version: 2007
Re: Numeric values not copying from source to target elaments
Hi Guys,
Is there any workout to identify the index number of an element which is present in measure dimension. I have a measure dimension 'p_Process' which has two elements 'Source Version' and 'Target Version'. The values to these elements are populated by creating dimension picklist from 'Version' dimension.
My cube looks as below:
p_Process
Source Version Target Version
p_Parameters Current Version 1
Parameter1 Version 2 Version 4
Parameter2
Parameter3
Parameter4
Parameter5
I have to identify the index number of 'current' , 'version 1' values in the measure elements which is passed by creating dimension picklist.
Is there any workout to identify the index number of an element which is present in measure dimension. I have a measure dimension 'p_Process' which has two elements 'Source Version' and 'Target Version'. The values to these elements are populated by creating dimension picklist from 'Version' dimension.
My cube looks as below:
p_Process
Source Version Target Version
p_Parameters Current Version 1
Parameter1 Version 2 Version 4
Parameter2
Parameter3
Parameter4
Parameter5
I have to identify the index number of 'current' , 'version 1' values in the measure elements which is passed by creating dimension picklist.