Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
markp201
Creator III
Creator III

Dollar sign expansion expression

I have a variable vFlag which I need to reference in an expression for inline table

My inline table

LOAD * INLINE [

field

5

6

-5

];

I need to add the value of vFlag to each row

LET vFlag = 1;

LOAD * INLINE [

field

5+vFlag

6+vFlag

-5+vFlag

];

So I get

6

7

4

I think I've tried just about every DSE variation but not the right one.

=($(vDST)+5) gives =(1+5)

=(1+5) for a textbox gives 6 so why not in the load script?   ARGH!!!

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Maybe

Let vFlag = 1;
  LOAD Field+$(vFlag) as Field inline [
Field
4
6
9
-5
]
;

Regards,

Antonio

View solution in original post

4 Replies
antoniotiman
Master III
Master III

Maybe

Let vFlag = 1;
  LOAD Field+$(vFlag) as Field inline [
Field
4
6
9
-5
]
;

Regards,

Antonio

marcus_sommer
MVP & Luminary
MVP & Luminary

You could try something like this:

LOAD field, rangesum(field, $(vDST)) as field2 INLINE [

field

5

6

-5

];

- Marcus

markp201
Creator III
Creator III
Author

Out of curiosity what would the expression be to add the variable to each row - as below?

Granted, its more complicated but need to get stronger grasp of DSE.  Thanks

LOAD * INLINE [

field

5+vFlag

6+vFlag

-5+vFlag

];

Peter_Cammaert
Partner - Champion III
Partner - Champion III

An INLINE block contains just text, not expressions. Therefore the LOAD is unaware that it should do something with the field values before storing them, although the $-sign expansion will work just fine.

If you want to change this, you can try the evaluate() function to force evaluation of a text string as an expression. In your example, that may look a bit ridiculous, but you'll understand how it works...

LET vFlag = 1;

LOAD Evaluate(field) AS field INLINE [

field

5+$(vFlag)

6+$(vFlag)

-5+$(vFlag)

];

The last value cannot be produced in this way though. QlikView always returns -4. Fair enough?

Best,

Peter