Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Inserting variable in script to be evaluated later in dimmension

Hi, I have a problem trying to insert a variable into a static table, then try to evaluate its value in runtime, but I keep getting errors.

Here's the scenario:

Step 1- Load a tatic table with the dynamic value

StaticTable:

                    NOCONCATENATE

                    LOAD * INLINE [

         DimDef, "IF($(var1)=0, 1, 0)"

                    ];

Step 2 - Use the field's value as a Calculated Dimension Expression:

$(=DimDef)

Result:

When I Load the data, the expression of the column is evaluated prior setting the dimension definition, and the static table's row has the following:

StaticTable:

DimDef

"IF(1=0)=0, 1, 0"

So, the value neves changes, since the variable was evaluated at load time, not in at "chart time"

I tried to play around with this approach and replacing the quotes but didnt worked:

http://community.qlik.com/message/59213#59213

Any Suggestion so I can enter "IF($(var1)=0, 1, 0)" in my static table and it goes untouched to my chart's calculated dimmension, so at the end, the expression will be calculated in runtime?

Thanks in advance for the time

-ed

1 Solution

Accepted Solutions
Not applicable
Author

You could try something like this:

load

  '$' & DimDef as DimDef

inline [

  DimDef

  (var1)

];

but that's much less readable than an external file.

View solution in original post

5 Replies
Not applicable
Author

As far as I can tell there's no way to turn off dollar sign expansion in the load scripts. For variables, you can use the replacement trick you referenced but for inline tables the only workaround I've found is to convert the inline table to a csv or excel file and load it from the file instead.

Not applicable
Author

Hi vhuynh, thanks for your recomendation, it look like you were trying to achieve the same some time ago, was the external file the only solution that you got this working?

I mentioned it to our lead and he didn't like to much the idea of having external files, this is why I am trying to get it to work somehow.

thanks again for your time.

-Ed

Not applicable
Author

You could try something like this:

load

  '$' & DimDef as DimDef

inline [

  DimDef

  (var1)

];

but that's much less readable than an external file.

Not applicable
Author

Sure! I'll try it right now

Not applicable
Author

Thanks a lot, it worked like a charm, great solution, now I can use dynamic functions as Calculated Dimmensions.

-ed