cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAC App Designer - ExpandNode syntax help

JBARLOW
Active Contributor
0 Kudos
2,189

Another SAC App Designer scripting question

I'd like to be able to use a script to drill down in a waterfall chart, the setHierarchylevel() parameter doesn't work
so think I need to use the expandNode() parameter.

I'm struggling to get my head round the expandNode syntax, the Developer guide isn't very clear (to me at least)

If anyone has a working example of this it'd be much appreciated

Example

Waterfall chart containing:
3 Measures - m1, m2, m3
1 Dimension which is part of a hierarchy "Group" > "Row"

The 'expand node' button in the below screenshots is where i'm testing syntax to try and get it working.

1. Waterfall chart

2. Via the UI - the 'expand group' icon functionality is what I'm trying to perform programmatically
(the eventual aim being that the node is expanded during a radio button onClick event)

3. The desired result - the Waterfall chart showing the expanded node / lower hierarchy level

Page 51 of the Developer Handbook provides the following example:

// One node (Location="California") is expanded
Chart_1.getDataSource().expandNode("Location_4nm2e04531",
{ "Location_4nm2e04531": "[Location_4nm2e04531].[State_47acc246_4m5x6u3k6s].&[SA1]",
// California "@MeasureDimension": "[Account_BestRunJ_sold].[parentId].&[Discount]" });

Accepted Solutions (0)

Answers (3)

Answers (3)

Hi James,

If you want to expand node(m1) by dimension "Group", you can refer to below script: Chart_1.getDataSource().expandNode("groupId", {[Alias.MeasureDimension]: "m1", "groupId": "groupMemberId"});

The first parameter is dimension id and second parameter is selection context. You need to replace "groupId" with dimension id of "Group" dimension, replace "groupDimensionMember" with dimension member id of "Group" and replace "m1" with measure id of "m1".

To get selection context of node "m1", you can use Chart.getDataSource.getDataSelections API.

console.log(Chart_1.getDataSource().getDataSelections());

martin_sit
Member

Hello,

we have exact the same issue. We want to drill down a hierarchie node via script.

If we adapt the script, like Roys, then we alway geht an error message "Cannot read property 'name' of undefined" (developer tools).

This is our script:

Chart_1.getDataSource().expandNode("ZXM_UKKS", {[Alias.MeasureDimension]:"781Y61TCOO1DEVWDJS0DI3MKJ", "ZXM_UKKS": "0HIER_NODE!00000000000000000000002010000000"});

ZXM_UKKS is the hierarchy dimension.

781Y61TCOO1DEVWDJS0DI3MKJ is the keyfigure.

0HIER_NODE!00000000000000000000002010000000 is the hierarchy node, which we want to expand based on the dimension ZXM_UKKS.

Is there a limitation for BW live Connections, to use this feature? How can we solve this?

kind regards,

Martin

cstudt
Newcomer
0 Kudos

Hello,

I have the same issue that Martin has described: "Cannot read properties of undefined (reading 'name')

".

I use a BW live connection as well. I would also like to know if there is a limitation or maybe a solution.

Thank you in advance and kind regards,

Christian

hasba
Participant
0 Kudos

Same issue, is there anybody who can comment if there is a restriction on BW live connection to expand the node of a hierarchy?

Dominik_Z
Participant
0 Kudos
Hello, I cannot make this work either. Script that works with "Table_1.getDataSource().expandNode(....)" does not work with "Chart_1.getDataSource().expandNode(....)" if chart is waterfall chart with the same Datasource. Api Ref Guide to "expandNode" says "For Waterfall charts with one or more dimensions, the selection specifies one dimension and one measure. For Waterfall charts with one measure but no dimensions, the selection specifies this measure. For Waterfall charts with more than one measure but no dimensions, this operation is ignored." So it should work somehow with waterfall charts. If anybody managed to get this work or find out about the restrictions, I would be very greatful for sharing. Thanks
edwardh
Explorer
0 Kudos

How would I do this to expand the current year in a table?

0 Kudos

I'm also trying to use getDataSource().expandNode() to do drill down. It can achieve the requirement, but the tables are keep refreshing after I triggered the expandNode(). Did anyone face this problem before?

I want to achieve click on Year level for one table, all tables drill down to Quarter level. Test script is as below:

G_Selection = Table_2.getSelections();

console.log(["Selections",G_Selection]);

var selection = G_Selection[0];

//console.log(["selection", selection]);

var valMeasure = Table_2.getDataSource().getResultMember("@MeasureDimension",selection);

//var valTime = Table_2.getDataSource().getResultMember("Time",selection);

//console.log(["valMeasure", valMeasure]);

//console.log(["valTime", valTime]);

var expandflag = 0;

//Check whether it's column header

if (valMeasure === undefined)

{

Table_2.getDataSource().expandNode("Time",selection);

Table_1.getDataSource().expandNode("Time",selection);

expandflag = 1;

}

Best Regards & Thanks,

Lilu.