Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Access Current Dimension/Expression Name within Formula?

Hiya Guys,

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:

=$(fnIncludeDim('TimelineDate'))

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!):

=$(fnIncludeDim($CurrentDimensionName))

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  :-)

Cheers,

Steve.

1 Solution

Accepted Solutions
MVP
MVP

Re: Access Current Dimension/Expression Name within Formula?

I've been wishing for this feature to exist for years! Something like a function this() or ThisDimension() or ThisExpression() - wouldnt' it be wonderful?

Unfortunately, as far as I know, it doesn't exist - I'd love to be wrong on this one!

5 Replies
MVP
MVP

Re: Access Current Dimension/Expression Name within Formula?

I've been wishing for this feature to exist for years! Something like a function this() or ThisDimension() or ThisExpression() - wouldnt' it be wonderful?

Unfortunately, as far as I know, it doesn't exist - I'd love to be wrong on this one!

Not applicable

Re: Access Current Dimension/Expression Name within Formula?

Thanks Oleg,

Yes, that's exactly what I require - it would be very useful!

I think you might be right - but I'll hang-fire for a little while longer in case anyone else has any insight... keep your fingers crossed!  :-)

Cheers,

Steve.

Not applicable

Re: Access Current Dimension/Expression Name within Formula?

*BUMP*  :-)

No one else with any ideas?

cheers,

Steve.

Not applicable

Re: Access Current Dimension/Expression Name within Formula?

Hiya Oleg,

Perhaps you and your colleagues could vote for this:

I thought, as it wasn't just my idea, it was worth requesting  :-)

Cheers,

Steve.

Not applicable

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.

Community Browser