Moving Modified Data Using Groovy Rules and Smart Push
In this topic, we’ll show you best practices on how you can use Groovy rules and Smart Push to move modified data into a reporting cube.
On a data form, users can modify employee salary and assign a Reporting Manager. After the form data is saved, Smart Push is run to copy data to the reporting cube for analysis. Then, dimensions are also consolidated, if necessary, as the data is being copied.
If the form contains hundreds of rows of data, all of that data is checked against the configured data map, processed for dimension consolidation, if any is set, and then pushed to the reporting cube. Depending on the amount of data on your form, this process may take a while to complete.
You can improve the performance of data synchronization between your input and reporting cubes by designing a Groovy rule that identifies and isolates the data you modified, and pushes only the isolated data into your reporting cube.
For example, we configured a simple data map for Smart Push that maps dimension members from our input cube to our reporting cube.
Then we prepared forms that display data from our input and reporting cubes.
The form used for data entry has Smart Push enabled and uses the form’s context to push data for all the members selected for the dimensions defined on the form.
For the Groovy rule, here’s the entire script.
The script starts by identifying the associated data map for smart push.
This section of the script uses the dataCellIterator
method to identify edited cells and isolates them.
Then, this section takes the isolated data and runs the focused data movement using Smart Push and the data map configured and associated with the form. A message displays when modified data is moved to the reporting cube.
If there are no modifications, a message displays when there are no changes and data was not moved to the reporting cube.
After we created this Groovy rule, we deployed it the same way we deploy business rules.
Then, in form management, associated it with the form. The Groovy rule runs after the form data is saved.
To run the Groovy rule, open the form in Input Cube, make some changes, and then click Save.
Once saved, the updated data will display in the reporting cube.