Currently it is not possible to pass an URL-Filter on Hierarchy Nodes for BW-Live Models with the standard options.
In this blog I´ll show how this can be accomplished with some simple scripting and story setup.
There is one story which contains input controls (or story filters) for specific dimensions with hierarchies and we would like to pass the selected members of the hierarchy (be it nodes or leafs) to another story where these values should be applied as respective filters again.
The jump to the other story is bound to a specific action, e.g. click on a button. This Event will be used to derive the selected members and pass them as URL parameters.
The event contains the following script (example for two relevant dimensions on input controls):
var dim1_string = "";
//only retrieve selected members if not all selected
if(IC_Dim1.getInputControlDataSource().isAllMembersSelected() === false){
var mem1 = IC_Dim1.getInputControlDataSource().getActiveSelectedMembers(10000);
for(var i=0;i<mem1.length;i++){
if(mem1[i].id.startsWith("PSEUDO")){ //really selected members
if(mem1[i].id.endsWith("-")){ //is a node
dim1_string = dim1_string.concat("/0HIER_NODE!".concat(mem1[i].displayId));
}
else{ //is a leaf
dim1_string = dim1_string.concat("/!".concat(mem1[i].displayId));
}
}
}
}
var p_dim1 = UrlParameter.create("p_dim1", dim1_string);
var dim2_string = "";
//only retrieve selected members if not all selected
if(IC_Dim2.getInputControlDataSource().isAllMembersSelected() === false){
var mem2 = IC_Dim2.getInputControlDataSource().getActiveSelectedMembers(100000);
for(var j=0;j<mem2.length;j++){
if(mem2[j].id.startsWith("PSEUDO")){ //really selected members
if(mem2[j].id.endsWith("-")){ //is a node
dim2_string = dim2_string.concat("/0HIER_NODE!".concat(mem2[j].displayId));
}
else{ //is a leaf
dim2_string = dim2_string.concat("/!".concat(mem2[j].displayId));
}
}
}
}
var p_dim2 = UrlParameter.create("p_dim2", dim2_string);
NavigationUtils.openStory("STORY_ID", "PAGE_ID", [p_dim1, p_dim2]);
Important to note is:
If the same should be done for story filters, the API "Application.getFileDataSource.getDimensionFilters" can be used which immediately only gives back the chosen nodes/leafs with the correct BW syntax. They can directly be concatenated into a string.
In the story on the receiving end these parameters are maintained as script variables:
E.g. in the onInit script, the parameters can be split into the members and applied to an input control (example of first dimension):
if(dim1.length>0){
var dim1_param = dim1.slice(1); //remove first char, is "/"
var dim1_arr = dim1_param.split("/");
IC_Dim1.getInputControlDataSource().setSelectedMembers(dim1_arr);
}
With this the correct hierarchy filters from Story 1 are passed to Story 2.
Do not hesitate to reach out in case of questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
9 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |