Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
mattphillip
Creator II
Creator II

GetObjectDimension() within expression (field names with spaces or special characters)

Good afternoon,

 

Hoping someone might be able to assist. I'm using the below code  within a user defined custom table extension to check whether a master measure (e.g. Get Dimension (=GetObjectDimension()) has a length greater than 1 - basicially works out how many dimensions are visible (maximum of 4). The dimension names are then pulled through to produce an accurate denominator value when calculating percentages based on the dimensions shown.

I've noticed however, that whilst this works for fields of a single word or no spaces, when fields with a space or character (e.g. '/' or '-'), it doesn't calculate as I'm assuming it doesn't recognise the field name. 

I've tried adding an additional set of square brackets and also have tried double quotes around the master measure name.

 

=if(len([Get Dimension (4th Dimension)])>1,aggr(nodistinct count(FTE),$(=[Get Dimension]),$(=[Get Dimension (2nd Dimension)]),
$(=[Get Dimension (3rd Dimension)]),$(=[Get Dimension (4th Dimension)])),

if(len([Get Dimension (3rd Dimension)])>1,aggr(nodistinct count(FTE),$(=[Get Dimension]),$(=[Get Dimension (2nd Dimension)]),
$(=[Get Dimension (3rd Dimension)])),

if(len([Get Dimension (2nd Dimension)])>1,aggr(nodistinct count(FTE),$(=[Get Dimension]),$(=[Get Dimension (2nd Dimension)])),

if(len([Get Dimension])>1,$(=[Get Dimension])),

count(total (FTE))))))

 

Does anyone have any ideas?

Any help is most appreciated.

Matt

Labels (5)
1 Solution

Accepted Solutions
marcus_sommer

I think the brackets are wrongly placed - inside the $-sign Expansion without a combining with the field respectively expression-result. This means it should be rather look like: $(='[' & Expression & ']') or it's just placed on the outside like: 

[$(= any content)]

- Marcus

View solution in original post

7 Replies
JoãoPolloni
Contributor III
Contributor III

Hello, have you tried using a function replace a name with these names to be able to calculate?

here it is in Portuguese BR, just to change to your language:

https://help.qlik.com/pt-BR/sense/May2022/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions...

mattphillip
Creator II
Creator II
Author

I haven't but I did find the solution. Inside the master measure, I added single quote, double quotes, single quote and an & at either end (see below) and it works!

='"'&GetObjectDimension()&'"'

Happy Days!

marcus_sommer

I think the brackets are wrongly placed - inside the $-sign Expansion without a combining with the field respectively expression-result. This means it should be rather look like: $(='[' & Expression & ']') or it's just placed on the outside like: 

[$(= any content)]

- Marcus

mattphillip
Creator II
Creator II
Author

Unfortunately your link doesn't seem to work. I'm interested in finding out more though.

mattphillip
Creator II
Creator II
Author

Thanks I'll take a look.

mattphillip
Creator II
Creator II
Author

Well it worked seemingly for a couple of minutes then it broke and I can't get it working again 😞