I have setup to fix one member in Global variable and select its children in a Hyperblock.
Is it possible to use Multiple members in Global variables and select all their children in a Hyperblock?
Yes
Use the Lookup object in App Studio and enable multi selection.
Write the selected elements to a report variable say rv_Region on the (required) action for your lookup object.
Also in the parameters section of the Edit Action Dialog add a second report Variable - say rv_RegionChildren and add a line like this as the formula: =IF(ISMULTISELECT(Actions.Result.Text),RUNPROCESS("MultiSelectChildren",-1,Actions.Result.Text),Actions.Result.Text& ".Children")The process to be called by RUNPROCESS would be: #define EngineVersion 5.0 #define RuntimeVersion 5.0 string MultiSelectChildren(string MultiSelectVariable)@Description: "John Robson: Take the value of a MultiSelect Variable and appends .children to all the included elements.";@Category: "Utilities";@Parameter[MultiSelectVariable]: "The input MultiSelect Variable.";@Returns: "Modifed MultiSelectVariable with .Children appended"; { //Version 1.00 10-Nov-23 //Note the the parent itself is not included in the returned variable string MSVariableChildren = StringReplace(MultiSelectVariable,"</MemberUName>",".Children</MemberUName>", false); return MSVariableChildren; }
In your report select the 2nd variable as an Element in your hyperblock if you want just the children or both variables if you also want parents.So comments:
- this is a very quick and dirty process, so no error checking
- if the user picks a base element then by definition it has no children
- if the user selects a single parent then the process isn't called, rather .children is appended to the unique name of the element they select
- this all works because of the simple xml generated by the lookup object etc.etc.
- you could probably do the replace in App Studio but as the process takes less than 500 ms with 3 elements selected I think it's ok
- there are undoubtedly better ways of doing this - this was the first though that came into my head.and it's fairly simple.
It is even simpler than that. In the hyperblock use children of the report variable used in the select element. When the variable contains multi-select XML the hyperblock will display the children of each element.