Access Current Dimension/Expression Name within Formula?
I have created a formula which, given the name of a Dimension (for example) returns whether or not the Dimension exists in the currently selected criteria:
fnIncludeDim: If (GetSelectedCount(_Dims)>0, SubStringCount(uvDimensions, $1 & ';'), 0)
My initial idea was to include this formula (parameterised variable) under each Dimension's "Enable Conditional" field:
This works great - and basically allows me to create a dynamic Straight Table based on which Dimensions the User has selected from a List Box.
However, with many Dimensions (and with a view to making my Dashboard as "generic" as possible so I can reuse it with other datasets) - my question is:
Is there any way to reference the name of the current Dimension from within a formula?
For example, the above "Enable Conditional" formula would become something like (pseudocode!):
This way I would be able to use the same formula (variable) for each Dimension, and the "Dimension Name" parameter would be automatically calculated for each Dimension and passed without having to hard-code it for each field.
Hopefully my question makes sense... I realise the answer is probably "No" - but I thought I'd ask you lovely people in case any of you have any ideas :-)
Re: Access Current Dimension/Expression Name within Formula?
You can use GetObjectField. GetObjectField takes the index of the dimension that you want, e.g, 1 for the first. The indexes are absolute, i.e., 1 will always return the first dimension regardless if it's enabled or not.