Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression Label

HI,

In a pivot table, I am trying to create an expression label that displays the Expression field minus the square brackets for example

Expression definition: 

[Event Outcome]

Expression Label:

I want to show: Event Outcome   (eg expression definition with out the [ ] brackets)

Kind regards

Dan

10 Replies
Anonymous
Not applicable
Author

Can't you just use the field "Label" on your Expresion tab for that?

Not applicable
Author

Hi Dennis,

Thank you for the reply. I could type this in manually in the expression label however I am hoping there is an automatic way to do this as I have to do this for multiple columns. Sorry I should have explained this in my original post.

kind regards,

Dan

Not applicable
Author

the easiest and most secure solution would be to just rename your expression.

if you can load your expression name somehow as a variable,you could use mid() to show only the text between the brackets.

mid(label,2,12)

Anonymous
Not applicable
Author

Where do the brackets come from? If they come from table names,  you can try rename them in your script, is that an option?

Load

[Event Outcome]  as "Event Outcome"

...


Not applicable
Author

The brackets are there because there is a space in the Field name. I could rename fields to have no Space or Underscore however this is not ideal. Alexander I think your idea is a good approach however how can we ‘load the expression name’?

We can also use replace instead of mid but the part I can not work out is loading the expression name to put into the formula!!!!

Thanks again,

Dan

Vegar
MVP
MVP

I don't see why the bracets end up in your application. Whenever I define fields with bracets they dissapear automaticly.

The script below will result in an application with the field name Record number without bracets.

LOAD

recno() as [Record number]

AUTOGENERATE 500

;

Could you provide a sample qvw file to show us the problem?

Not applicable
Author

Thanks for the reply, the brackets only appear in the label when placed in the ‘Chart Expression’. There are no brackets when using the field as a dimension

For example:

Record number

1

1

2

2

3

3

4

4

5

5

6

6

Thanks Again

Dan

Not applicable
Author

daniel.garge wrote:

however  how can we ‘load the expression name’?

this was a theoretical solution. ive only tryed this with data fields and their names.

since its an expression, it is now stored in the memory like the objects from the data tables

Not applicable
Author

Thanks Alexander, Are you able to explain how you did this for data field? Hopefully from there I can work out how to retrieve/reference the expression definition.

Kind regards,

DAn