XLCubed is now FluenceXL. The new wiki can be found here: https://help.fluencexl.com/ |
Difference between revisions of "XL3SetProperty"
(→Example) |
(→Example) |
||
Line 320: | Line 320: | ||
=XL3SetProperty("Grid","GridToSet","HierarchiesOnHeaders",$L$32,$L$33) | =XL3SetProperty("Grid","GridToSet","HierarchiesOnHeaders",$L$32,$L$33) | ||
− | This is passing the values of cells L32 and L33 as the hierarchies on the headers of the grid. | + | |
+ | *This is passing the values of cells L32 and L33 as the hierarchies on the headers of the grid. | ||
*N17 contains the value of the row slicer (Product or Region). L31 also contains a VLOOKUP statement | *N17 contains the value of the row slicer (Product or Region). L31 also contains a VLOOKUP statement |
Revision as of 16:02, 10 October 2011
This function updates XLCubed objects in the workbook such as grids, slicers and small multiples.
You can use this to update some setting from the properties screen or move hierarchies.
Contents
[hide]Syntax
XL3SetProperty( ObjectType, ObjectName, Property, Arg1, [Arg2],…, [Arg27] )
Parameters
Parameter | Description |
---|---|
ObjectType | Object Type to update. Valid values are "Workbook", "Grid", "Slicer" and "SmallMultiple". |
ObjectName | Name of the object to update. You can not update an object unless you have given it a name in its properties screen. |
Property | Name of the property to update. Valid names depend on the object type. Details for each are below. |
Arg1, [Arg2],…, [Arg27] | Value or values to set the property to. Valid values depend on the object type. Details for each are below. |
Workbook
For workbook level properties the object name refers to the area of the product being updated.
Object Name | Property | Description | Value |
---|---|---|---|
"Writeback" | "SpreadMethod" | Sets the formula spread method. | Valid values are "USE_EQUAL_ALLOCATION", "USE_EQUAL_INCREMENT", "USE_WEIGHTED_ALLOCATION", "USE_WEIGHTED_INCREMENT" |
Grid
Grid Display
Property | Description | Value |
---|---|---|
"RemoveEmptyColumns" | Sets the columns to hide or show members with no data. | TRUE or FALSE |
"RemoveEmptyRows" | Sets the rows to hide or show members with no data. | TRUE or FALSE |
"HierarchiesOnHeaders" | Sets hierarchies on headers. Will move hierarchies as required. | Hierarchy name or names. |
"HierarchiesOnColumns" | Sets hierarchies on columns. Will move hierarchies as required. | Hierarchy name or names. |
"HierarchiesOnRows" | Sets hierarchies on rows. Works as HierarchiesOnColumns. | Hierarchy name or names. |
"MergeRepeatingCells" | Merge cells containing the same member in cross-joins. | TRUE or FALSE |
"MemberSelectionType" | Sets the selection type of the members, e.g. children, parent, descendants etc. | See the Member Selection Type section for more details. |
Grid Permissions
See Grid Permissions for details of what the following options do.
Property | Value |
---|---|
"ColumnMembers" | TRUE or FALSE |
"ColumnNavigation" | TRUE or FALSE |
"RowMembers" | TRUE or FALSE |
"RowNavigation" | TRUE or FALSE |
"DimensionNavigation" | TRUE or FALSE |
"Menus" | TRUE or FALSE |
"SlicerMembers" | TRUE or FALSE |
Slicer
Property | Description | Value |
---|---|---|
"RemoveEmpty" | Sets the slicer to hide or show members with no data. | TRUE or FALSE |
"Visible" | Show or hide the slicer (will only be applied for published reports). | TRUE or FALSE |
"MultiSelect" | Allow multi selection on the slicer, dependant on slicer type. | TRUE or FALSE |
"MemberSelectionType" | Sets the selection type of the members, e.g. children, parent, descendants etc. | See the Member Selection Type section for more details. |
SmallMultiple
Property | Description | Value |
---|---|---|
"RemoveEmptyCategories" | Sets the categories to hide or show members with no data. | TRUE or FALSE |
"RemoveEmptySeries" | Sets the series to hide or show members with no data. | TRUE or FALSE |
"RemoveEmptyColumns" | Sets the columns to hide or show members with no data. | TRUE or FALSE |
"RemoveEmptyRows" | Sets the rows to hide or show members with no data. | TRUE or FALSE |
"HierarchiesOnCategories" | Sets hierarchies on categories. Will move hierarchies as required. | Hierarchy name or names. |
"HierarchiesOnSeries" | Sets hierarchies on series. Works as HierarchiesOnCategories. | Hierarchy name or names. |
"HierarchiesOnColumns" | Sets hierarchies on columns. Works as HierarchiesOnCategories. | Hierarchy name or names. |
"HierarchiesOnRows" | Sets hierarchies on rows. Works as HierarchiesOnCategories. | Hierarchy name or names. |
"MemberSelectionType" | Sets the selection type of the members, e.g. children, parent, descendants etc. | See the Member Selection Type section for more details. |
"ChartType" | Sets chart type of the series. | Valid values are "Column", "StackedColumn", "StackedColumn100", "Bar", "StackedBar", "StackedBar100", "Area", "StackedArea", "StackedArea100", "Line". |
"ChartType2" | Sets chart type of the series once moved to the secondary axis. | Same as ChartType. |
Member Selection Type
Arguments
When setting the member selection type you must pass two or three additional arguments.
Argument | Description |
---|---|
Hierarchy name | The hierarchy that will be updated. |
Selection type | The type of selection to be applied. |
Index (Optional) | Which member to apply the selection to. If not passed then the selection will be applied to all members. |
Selection Types
Value | Description |
---|---|
"Member" | Only the member itself is returned. |
"Children" | Children of the member are returned. |
"Ancestors" | All ancestors of the member are returned. |
"Descendants" | All descendants of the member are returned. |
"FirstChild" | First child of the member is returned. |
"FirstSibling" | First sibling of the member is returned. |
"LastChild" | Last child of the member is returned. |
"LastSibling" | Last sibling of the member is returned. |
"LowestDescendants" | Descendants of the member from the lowest level are returned. |
"Parent" | Parent of the member is returned. |
"SameLevel" | All members at the level of the member are returned. |
"Siblings" | All siblings of the member are returned. |
"Next:X" | The member and the next "X" members at the level are returned. X must be a number. |
"Prev:X" | The member and the previous "X" members at the level are returned. X must be a number. |
"DescendantsAt:X" | Descendants of the member from the level "X" are returned. X must be a number, or level name. |
Example
This example uses a local cube, which holds a measure ‘Value’ against Products and Regions across time. We require a report that allows the user to dynamically select which hierarchies appear on rows and then the level of detail that appears – ie at member, children or descendants of that hierarchy.
We want the user to be able to run the report with either Product or Region on rows; slicer choices must change accordingly so that if the report is being run with Regions on rows the slicer choices must only be based on Region; similarly when running with Product on rows, the slicer must only offer choices of Product.
- The report is shown below:
- We will need to create a number of slicers so that we can change hierarchies and level of detail displayed:
- Create a slicer which will allow the user to select which hierarchy appears on rows.
- This slicer will pick its range from values in cells K18 & K19 and will update N17 with the user selection.
- Create another slicer which will allow the user to select a particular Region. This will put the user selection in L29.
- Create the slicer that will allow the user to select All or a particular Product.
- Create the fourth slicer that allows the user to select the member level – eg member, children or descendants. This slicer will pick its range from values in cells L13 to L15 and update L30 with value selected.
- This screenshot shows the values and settings that will allow the user to use XL3setproperty to define the setup of the grid report.
- Populate cells K18 & K19 with the valid options for hierarchies on rows – we are using Region and Product in this example. In cells L18 & L19 enter the valid cube hierarchy name.
You must name the object type – in our example our grid is called GridToSet – this has been updated using the Properties screen.
- There are three XL3SetProperty statements in our example, updating properties MemberSelectionType; HierarchiesOnRows and HierarchiesOnHeaders.
- setMemberSelType – the two cells to the right hold the following XL3SetProperty statement:
In cell L21:
=XL3SetProperty("Grid","GridToSet","MemberSelectionType","[Region]",IF(N17="Region", $L$30, "Member"))
This is passing Region as an argument when the user has selected this option from the first slicer.
In cell M21:
=XL3SetProperty("Grid","GridToSet","MemberSelectionType","[Product]",IF(N17="Product", $L$30, "Member"))
This is passing Product as an argument when the user has selected this option from the first slicer.
- Set Rows – the cell to the right holds the following XL3SetProperty statement:
=XL3SetProperty("Grid","GridToSet","HierarchiesonRows",$L$31)
- This is passing the value of L31 as an argument for the hierarchy that should appear on rows of the grid.
- Set Header – the cell to the right holds the following xl3SetProperty statement:
=XL3SetProperty("Grid","GridToSet","HierarchiesOnHeaders",$L$32,$L$33)
- This is passing the values of cells L32 and L33 as the hierarchies on the headers of the grid.
- N17 contains the value of the row slicer (Product or Region). L31 also contains a VLOOKUP statement
=VLOOKUP(N17,K18:L19,2,FALSE)
- L32 contains Excel MID function and allows the swapping of the values of Rows and Headers.
=IF(MID(L31,1,3)="[Pr",L18,L19)
- If the first two characters of the string in L31 are ‘Pr’ then take the value of L18 else the value of L19.
- In this way we can swap the value between Region and Product on rows and headers.