Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulcalvet
Partner - Specialist
Partner - Specialist

Put a measure value into a number variable

Hello,

I try to retrieve a measure value and store it into a variable.

It works with a string variable but not with a number !

paulcalvet_0-1705671584653.png

The output is always 0, I try to convert, replace space by "", multiply by one, etc.. 

Here is the log : in text it works

paulcalvet_0-1705672632618.png

In number it doesn't work :

paulcalvet_1-1705672662083.png

Please help I don't find the solution !

You can find attached the automation.

Regards,

Paul

Labels (1)
1 Solution

Accepted Solutions
AfeefaTk
Support
Support

Hi @paulcalvet 

So yes, I kind of got the issue and I can reproduce it.

I am not able to remove spaces using the existing formulas in QAA.

I tried with a custom code block to remove spaces in between the measure value, then set it as the value of the variable and it worked for me. 

I am not sure if there is any other easy solution to achieve this.

For now, let me share the automation workspace that worked with custom code block.

Please let me know your feedback.

Regards

Afeefa TK

View solution in original post

16 Replies
rubenmarin

Hi, it looks like the measure has 2 numbers separated by an space, maybe that's the cause it can only interpreted as a string.

I've tested the automation with the ctrl+00 script and it works

rubenmarin_0-1705735667220.png

 

paulcalvet
Partner - Specialist
Partner - Specialist
Author

Yes,  it's certainly the format number.

But when I try to convert it or to remove space from string, it doesn't work.

I will try it with a measure without format, but It's a bad workaround to duplicate measure.

rubenmarin

Hi, I tested but I didn't know either how to remove spaces in the text using the automation, but instead of duplicating the full expression you can create another expression that just removes spaces from the original measure, like creating a Non_space_Measure that has the expression:

PurgeChar(Original_Expression_Name, ' ')

At least if you change the expression formula you only need to update the original.

Or wait for someone with more knowledge than me about how to do the same in automations.

 

marcus_sommer

Formatting is useful for a human viewing but on a programmatic process it's the opposite of helpful ...

paulcalvet
Partner - Specialist
Partner - Specialist
Author

In this use case, I work in managed space so I can't create new measure, and I'm not in favour duplicate objects to manage number formating 🙂

Maybe a moderator can help ?

@Jeffrey_Goldberg do you know how we can use a measure in automation when this measure have a format ? in my case, the result is understood as a string.

Regards,

Paul

AfeefaTk
Support
Support

Hi @rubenmarin 

@paulcalvet 

Could you please let me know what exactly you are trying to achieve here?

Regards

rubenmarin

Hi @AfeefaTk it looks like theree is a variable with a number stored using an empty space as thousand separator, probably this causes to be readed as two diffrent values, which returns null(), and the possible solution would be to add an step in automation that removes the space or interprets the space as thousand separator so the value can be readed as a number.

AfeefaTk
Support
Support

Hi @rubenmarin 

So you have a solution using automation?
Its working for you?

Or do you need any help here?

Regards

rubenmarin

Hi @AfeefaTk, thanks for your quick answer... I was just summaryzing the thread. @paulcalvet is the one that needs the solution. Let's wait to confirm if @paulcalvet has a solution or still needs help.