Page 1 of 1

Hold, Release Hold via Rest API or TI Process?

Posted: Fri Aug 04, 2023 9:41 am
by raeldor
Can this be done via the rest API, or even TI process?

Thanks
Ray

Re: Hold, Release Hold via Rest API or TI Process?

Posted: Fri Aug 04, 2023 6:52 pm
by Paul Segal
Yes, see https://www.tm1forum.com/viewtopic.php?t=14399, where Wim describes how for a TI. It should be possible to do the same using the REST API as it's basically creating a control cube if it doesn't exist and then applying strings to one or more cells. See also https://www.ibm.com/docs/en/planning-an ... e-cubename and https://www.ibm.com/docs/en/planning-an ... ic=cd-hold

Paul

Re: Hold, Release Hold via Rest API or TI Process?

Posted: Thu Aug 10, 2023 9:19 pm
by Wim Gielis
Hello,

Here is a TI approach. The process will read a text file and apply holds to the given combinations.
In the example it will lead to 13 holds in the cube, as the combination in line 14 cannot be located in the cube.
It gives us 13 holds (red triangles) at several levels in the cube.
holds.PNG
holds.PNG (186.68 KiB) Viewed 931 times
_Add holds.pro
(10.28 KiB) Downloaded 136 times
data.txt
(200 Bytes) Downloaded 127 times
With the code listing to generate the test cube as well, to save time for those that want to play with it:

Code: Select all

###########################
# Cube: 'testholds'
###########################

vCube = 'testholds';

vDim1 = 'D1';
vDim2 = 'Region';
vDim3 = 'Msr';


If( CubeExists( vCube ) > 0 );
  ProcessBreak;
EndIf;



###########################
# Dimension: D1
###########################

vDim = vDim1;

# dimension creation
If( DimensionExists( vDim ) = 0 );
    DimensionCreate( vDim );
EndIf;

# inserting elements (N and C and S)
DimensionElementInsert( vDim, '', 'Alle maanden', 'C' );
DimensionElementInsert( vDim, '', '2020', 'C' );
DimensionElementInsert( vDim, '', '202001', 'N' );
DimensionElementInsert( vDim, '', '202002', 'N' );
DimensionElementInsert( vDim, '', '202003', 'N' );
DimensionElementInsert( vDim, '', '202004', 'N' );
DimensionElementInsert( vDim, '', '202005', 'N' );
DimensionElementInsert( vDim, '', '202006', 'N' );
DimensionElementInsert( vDim, '', '202007', 'N' );
DimensionElementInsert( vDim, '', '202008', 'N' );
DimensionElementInsert( vDim, '', '202009', 'N' );
DimensionElementInsert( vDim, '', '202010', 'N' );
DimensionElementInsert( vDim, '', '202011', 'N' );
DimensionElementInsert( vDim, '', '202012', 'N' );
DimensionElementInsert( vDim, '', '2021', 'C' );
DimensionElementInsert( vDim, '', '202101', 'N' );
DimensionElementInsert( vDim, '', '202102', 'N' );
DimensionElementInsert( vDim, '', '202103', 'N' );
DimensionElementInsert( vDim, '', '202104', 'N' );
DimensionElementInsert( vDim, '', '202105', 'N' );
DimensionElementInsert( vDim, '', '202106', 'N' );
DimensionElementInsert( vDim, '', '202107', 'N' );
DimensionElementInsert( vDim, '', '202108', 'N' );
DimensionElementInsert( vDim, '', '202109', 'N' );
DimensionElementInsert( vDim, '', '202110', 'N' );
DimensionElementInsert( vDim, '', '202111', 'N' );
DimensionElementInsert( vDim, '', '202112', 'N' );

# inserting parent-child relations
DimensionElementComponentAdd( vDim, 'Alle maanden', '2020', 1 );
DimensionElementComponentAdd( vDim, '2020', '202001', 1 );
DimensionElementComponentAdd( vDim, '2020', '202002', 1 );
DimensionElementComponentAdd( vDim, '2020', '202003', 1 );
DimensionElementComponentAdd( vDim, '2020', '202004', 1 );
DimensionElementComponentAdd( vDim, '2020', '202005', 1 );
DimensionElementComponentAdd( vDim, '2020', '202006', 1 );
DimensionElementComponentAdd( vDim, '2020', '202007', 1 );
DimensionElementComponentAdd( vDim, '2020', '202008', 1 );
DimensionElementComponentAdd( vDim, '2020', '202009', 1 );
DimensionElementComponentAdd( vDim, '2020', '202010', 1 );
DimensionElementComponentAdd( vDim, '2020', '202011', 1 );
DimensionElementComponentAdd( vDim, '2020', '202012', 1 );
DimensionElementComponentAdd( vDim, 'Alle maanden', '2021', 1 );
DimensionElementComponentAdd( vDim, '2021', '202101', 1 );
DimensionElementComponentAdd( vDim, '2021', '202102', 1 );
DimensionElementComponentAdd( vDim, '2021', '202103', 1 );
DimensionElementComponentAdd( vDim, '2021', '202104', 1 );
DimensionElementComponentAdd( vDim, '2021', '202105', 1 );
DimensionElementComponentAdd( vDim, '2021', '202106', 1 );
DimensionElementComponentAdd( vDim, '2021', '202107', 1 );
DimensionElementComponentAdd( vDim, '2021', '202108', 1 );
DimensionElementComponentAdd( vDim, '2021', '202109', 1 );
DimensionElementComponentAdd( vDim, '2021', '202110', 1 );
DimensionElementComponentAdd( vDim, '2021', '202111', 1 );
DimensionElementComponentAdd( vDim, '2021', '202112', 1 );




###########################
# Dimension: Region
###########################

vDim = vDim2;

# dimension creation
If( DimensionExists( vDim ) = 0 );
    DimensionCreate( vDim );
EndIf;

# inserting elements (N and C and S)
DimensionElementInsert( vDim, '', 'World', 'C' );
DimensionElementInsert( vDim, '', 'Americas', 'C' );
DimensionElementInsert( vDim, '', 'North America', 'C' );
DimensionElementInsert( vDim, '', '1', 'N' );
DimensionElementInsert( vDim, '', '2', 'N' );
DimensionElementInsert( vDim, '', '3', 'N' );
DimensionElementInsert( vDim, '', 'South America', 'C' );
DimensionElementInsert( vDim, '', '4', 'N' );
DimensionElementInsert( vDim, '', '5', 'N' );
DimensionElementInsert( vDim, '', '6', 'N' );
DimensionElementInsert( vDim, '', '7', 'N' );
DimensionElementInsert( vDim, '', 'Europe', 'C' );
DimensionElementInsert( vDim, '', 'Benelux', 'C' );
DimensionElementInsert( vDim, '', '11', 'N' );
DimensionElementInsert( vDim, '', '12', 'N' );
DimensionElementInsert( vDim, '', '13', 'N' );
DimensionElementInsert( vDim, '', 'Central Europe', 'C' );
DimensionElementInsert( vDim, '', '16', 'N' );
DimensionElementInsert( vDim, '', '17', 'N' );
DimensionElementInsert( vDim, '', 'Iberia', 'C' );
DimensionElementInsert( vDim, '', '18', 'N' );
DimensionElementInsert( vDim, '', '19', 'N' );
DimensionElementInsert( vDim, '', 'Islands', 'C' );
DimensionElementInsert( vDim, '', '14', 'N' );
DimensionElementInsert( vDim, '', '15', 'N' );
DimensionElementInsert( vDim, '', 'Scandinavia', 'C' );
DimensionElementInsert( vDim, '', '10', 'N' );
DimensionElementInsert( vDim, '', '8', 'N' );
DimensionElementInsert( vDim, '', '9', 'N' );
DimensionElementInsert( vDim, '', 'Southern Europe', 'C' );
DimensionElementInsert( vDim, '', '20', 'N' );
DimensionElementInsert( vDim, '', '21', 'N' );

# inserting parent-child relations
DimensionElementComponentAdd( vDim, 'World', 'Americas', 1 );
DimensionElementComponentAdd( vDim, 'Americas', 'North America', 1 );
DimensionElementComponentAdd( vDim, 'North America', '1', 1 );
DimensionElementComponentAdd( vDim, 'North America', '2', 1 );
DimensionElementComponentAdd( vDim, 'North America', '3', 1 );
DimensionElementComponentAdd( vDim, 'Americas', 'South America', 1 );
DimensionElementComponentAdd( vDim, 'South America', '4', 1 );
DimensionElementComponentAdd( vDim, 'South America', '5', 1 );
DimensionElementComponentAdd( vDim, 'South America', '6', 1 );
DimensionElementComponentAdd( vDim, 'South America', '7', 1 );
DimensionElementComponentAdd( vDim, 'World', 'Europe', 1 );
DimensionElementComponentAdd( vDim, 'Europe', 'Benelux', 1 );
DimensionElementComponentAdd( vDim, 'Benelux', '11', 1 );
DimensionElementComponentAdd( vDim, 'Benelux', '12', 1 );
DimensionElementComponentAdd( vDim, 'Benelux', '13', 1 );
DimensionElementComponentAdd( vDim, 'Europe', 'Central Europe', 1 );
DimensionElementComponentAdd( vDim, 'Central Europe', '16', 1 );
DimensionElementComponentAdd( vDim, 'Central Europe', '17', 1 );
DimensionElementComponentAdd( vDim, 'Europe', 'Iberia', 1 );
DimensionElementComponentAdd( vDim, 'Iberia', '18', 1 );
DimensionElementComponentAdd( vDim, 'Central Europe', '19', 1 );
DimensionElementComponentAdd( vDim, 'Iberia', '19', 1 );
DimensionElementComponentAdd( vDim, 'Europe', 'Islands', 1 );
DimensionElementComponentAdd( vDim, 'Islands', '14', 1 );
DimensionElementComponentAdd( vDim, 'Islands', '15', 1 );
DimensionElementComponentAdd( vDim, 'Europe', 'Scandinavia', 1 );
DimensionElementComponentAdd( vDim, 'Scandinavia', '10', 1 );
DimensionElementComponentAdd( vDim, 'Scandinavia', '8', 1 );
DimensionElementComponentAdd( vDim, 'Scandinavia', '9', 1 );
DimensionElementComponentAdd( vDim, 'Europe', 'Southern Europe', 1 );
DimensionElementComponentAdd( vDim, 'Southern Europe', '20', 1 );
DimensionElementComponentAdd( vDim, 'Southern Europe', '21', 1 );




###########################
# Dimension: Msr
###########################

vDim = vDim3;

# dimension creation
If( DimensionExists( vDim ) = 0 );
    DimensionCreate( vDim );
EndIf;

# inserting elements (N and C and S)
DimensionElementInsert( vDim, '', 'T', 'C' );
DimensionElementInsert( vDim, '', 'P', 'N' );
DimensionElementInsert( vDim, '', 'Q', 'N' );

# inserting parent-child relations
DimensionElementComponentAdd( vDim, 'T', 'P', 2 );
DimensionElementComponentAdd( vDim, 'T', 'Q', 1 );



###########################
# Dimension: }Hold
###########################

vDim = '}Hold';

# dimension creation
If( DimensionExists( vDim ) = 0 );
    DimensionCreate( vDim );
EndIf;

# inserting elements (N and C and S)
DimensionElementInsert( vDim, '', 'HoldStatus', 'S' );





# Cube creation
CubeCreate( vCube
  , vDim1
  , vDim2
  , vDim3
);

Re: Hold, Release Hold via Rest API or TI Process?

Posted: Sun Aug 13, 2023 11:22 am
by Wim Gielis
A new custom TI process was proposed by myself to Bedrock TM1. It was approved:
https://github.com/cubewise-code/bedrock/pull/378

The process allows to create a holds cube, destroy a holds cube, release all holds, export all holds, import all holds.
This can be done for a selection of cubes, and clients and groups.

All feedback welcome.