Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable as Text in a Field

Good morning all,

I'm having difficulty creating a field where its data is equal to the value of a variable. For example, at the beginning of my script I have

Set vProjectionDate = 2011-12-01

I want to use this variable in several places like to open up an Excel file with that name and create a QVD with that name. I can do that with no issues.

The problem comes when I do this:

Projections:

Load

Temp_ITEM as ITEM,

Temp_MONTH as MONTH,

Temp_PROJECTION as PROJECTION,

$(vProjectionDate) & ' Projections' as PROJECTION_Date

Resident Temp_Projections;

The values of PROJECTION_Date end up being 1998 Projections (which is 2011 minus 12 minus 1).

I want the values in PROJECTION_Date to be 2011-12-01 Projections.

Is this possible?

Thanks,

Justin

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Enclose your dollar sign expansion into single quotes:

...

'$(vProjectionDate)' & ' Projections' as PROJECTION_Date

...

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Enclose your dollar sign expansion into single quotes:

...

'$(vProjectionDate)' & ' Projections' as PROJECTION_Date

...

Hope this helps,

Stefan

Not applicable
Author

It worked! Thanks a lot!