Dayalan Punniyamoorthy Blog

Friday, May 24, 2024

All About Clear Cube & Merge Data Slices!

 In this Blog post we will explore the Clear Cube & Merge Data Slices option in Planning and can be leveraged to EPCM applications using the REST API & Groovy


Clear Cube

The Clear Cube can be accessed from the Simplified Interface. 


It does allow to Create a “Clear Cube” job in this screen where you can select the Cube you want to clear the data.

It does have the options on what needs to be cleared?

The Clear Options  

Lets see the option on how to invoke the Clear Cube using the REST API. 

The Clear Cube job deletes the data you specify within input and reporting cubes, but it does not delete the application definition in the application's relational tables.





With Partial Data Clear it gives the option to chose the POV to clear the data in Basic Mode
You can select the Sub Variables to define the clear. By Selecting the 




By Selecting the Advanced Mode you will be able to specify the MDX query for the clear.

Clear Essbase data only by using an MDX expression in the text box provided. 

* Essbase Data Logical: In which the input cells in the specified region are written to a new data slice with negative, compensating values that result in a value of zero for the cells you want to clear. The process for logically clearing data completes in a length of time that is proportional to the size of the data being cleared. Because compensating cells are created, this option increases the size of the database. 

* Essbase Data Physical: In which the input cells in the specified region are physically removed from the aggregate storage database. The process for physically clearing data completes in a length of time that is proportional to the size of the input data, not the size of the data being cleared. Therefore, you might typically use this method only when you need to remove large slices of data.




Sample Payload

{"jobType":"CLEAR_CUBE", "jobName":"ClearPlan1"} 

Lets explore how to invoke the "Clear Cube"  using the REST API & Groovy, 

jsonResponse = operation.application.getConnection("Localhost").post('/rest/v3/applications/PCM/jobs')

    .header("Content-Type", "application/json")

    .body(json([

        "jobType" : "Clear Cube",

        "jobName" : "CLR_PCM_01"

        ])

    )

    .asString();

    println 'Response Received'

    println jsonResponse.body

Creating a POST Request:

    • The code starts by creating a POST request to a specific endpoint using the post() method.
    • The endpoint is '/rest/v3/applications/PCM/jobs'.
Setting Headers:
  1. The .header("Content-Type", "application/json") line sets the request header to indicate that the content being sent is in JSON format.
Setting Request Body:
  1. The .body(json([...])) part specifies the request body.
  2. Inside the json([...]), we have an array with two key-value pairs:
    • "jobType" : "Clear Cube": This indicates the type of job being requested (in this case, “Clear Cube”).
    • "jobName" : "CLR_PCM_01": This specifies the name of the job (“CLR_PCM_01”).
Executing the Request:
  1. The .asString() method sends the request and receives the response.
  2. The response is stored in the jsonResponse variable.
Printing the Response:
  1. The println 'Response Received' line prints a message indicating that the response has been received.
  2. The println jsonResponse.body line prints the actual response body.

In summary, this code snippet sends a POST request to the specified endpoint with a JSON payload containing job information. It then prints the response received from the server.




Merge Data Slices

Merges incremental data slices of an ASO cube. Fewer slices improve a cube’s performance. You can merge all incremental data slices into the main database slice or merge all incremental data slices into a single data slice without changing the main database slice. You can optionally remove cells that have a value of zero.  

Can be accessed from Jobs Console under Schedule you should be able to locate the Merge Data Slices. 

 
It can be Scheduled or run immediately. 


Which gives the following options, of selecting the Cube to run the Merge along with other options.


The following Table summarizes the client request parameters specific to this job,

Groovy Code: 

jsonResponse = operation.application.getConnection("Localhost").post('/rest/v3/applications/PCM/jobs')

    .header("Content-Type", "application/json")

    .body(json([

        "jobType" : "Merge Data Slices",

        "jobName" : "Merge Data Slices PCMRPT",

        "parameters": [

        "cubeName": "PCMRPT",

        "mergeSliceType": "allIncrementalSlicesInMain",

        "keepZeroCells": "false"

    ]

        ])

    )

    .asString();

    println 'Response Received'

    println jsonResponse.body 


Establish Connection:

 jsonResponse = operation.application.getConnection("Localhost").post('/rest/v3/applications/PCM/jobs')

Set Request Body:

This specifies the body of the request, formatted as JSON. The JSON object includes:

  • "jobType": Type of the job to be performed, here it's "Merge Data Slices".
  • "jobName": Name of the job, here it's "Merge Data Slices PCMRPT".
  • "parameters": An array of parameters for the job:
    • "cubeName": Name of the cube to be processed, here it's "PCMRPT".
    • "mergeSliceType": Type of merge operation, here it's "allIncrementalSlicesInMain".
    • "keepZeroCells": A flag indicating whether to keep zero cells, here set to "false".

 




Hope this Helps, Happy Days on the Cloud!

No comments:

Post a Comment