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
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.
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.
{"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'.
- The .header("Content-Type", "application/json") line sets the request header to indicate that the content being sent is in JSON format.
- The .body(json([...])) part specifies the request body.
- 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”).
- The .asString() method sends the request and receives the response.
- The response is stored in the jsonResponse variable.
- The println 'Response Received' line prints a message indicating that the response has been received.
- 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.
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".
No comments:
Post a Comment