Get ready for a Smarter Smart Push – Quick Tip # 4

I’m on a project where Smart Push is used quite a lot to create a Real-Time ASO reporting application, and this one was an annoying issue.

While performing the Smart Push (Roshin and Varun, my partners in crime) found that it takes an awful lot of time to move the data if we use the ILvl0Descendants(Account) function. If I add the accounts manually (level 0 member count from the function – 450, hand-picked accounts count- 332), it takes seconds.

Smart Push – without the magic

As you can see, it took 13 mins for the Smart Push to complete.

I contacted Support and then talked to Venu and Leela (people behind Smart Push) to find out what is going on.

After a while, they did come back with a solution.

As I said in the previous blog posts, Smart Push and Data maps use different mechanisms for pushing data.

When you create a calc script and add Dynamic calc members to your fix statement, those are ignored (unless you specifically use DataExportDynamicCalc; which is not possible on Cloud). However, if you do this in Smart View, those dynamic members are also retrieved.

That was precisely what was happening with the Smart Push. It was pulling all the dynamic accounts (calculating on the fly) and then trying to update ASO.

Leela and Venu informed me that the upcoming release (maybe Dec’19) would have an option in Smart Push to exclude members (from Webform editor itself) since I’m using Groovy I don’t have to wait for that release. I can use the override exclude member map while running Smart Push from the Groovy rule.

Groovy code for removing Dynamic calc members

def accountDim = operation.application.getDimension("Account", cube)
def dynamicCalcAccountMembers = accountDim.getEvaluatedMembers("ILvl0Descendants(Account)", cube).findAll { it.toMap().get('Data Storage (Plan1)') == 'dynamic calc'}.collect{fixValues(it)}
String dynamicCalcAccountList = dynamicCalcAccountMembers.join(',')
operation.grid.getSmartPush("All_Financial_Accounts").execute(["Account":"ILvl0Descendants(Account)"],["Account": dynamicCalcAccountList], true)

I’m asking Groovy to find all the members that are level 0 descendants of Account, which are dynamic calc on line 2.

The Member class in groovy supports a function (toMap) that allows you to retrieve all the OLU member properties. If you print the map, you’ll notice that it is the header of the dimension build file. All we got to do now is to check whether the Plan Type specific storage is dynamic calc or not.

Once all the dynamic calc members get populated as a list, join that list to make a comma-separated string and pass that in the overrideExcludeMember map (line 5)

Smart Push – with the magic

Here is the result. Yes, 13 minutes to 22 seconds!

Leave a comment

Your email address will not be published. Required fields are marked *