Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
jessica_webb
Creator III
Creator III

Variable as string in script

I have a variable in my script as follows:

Set vAcadyear = 2016-17;

I then use this in several other places in my script (mostly in file names) which works just fine.

So

FROM

[$(vAcadyear)\Misc\Map.xls]

(biff, embedded labels, table is Points$);

Becomes

FROM

[2016-17\Misc\Map.xls]

(biff, embedded labels, table is Points$);

which is exactly what I want.

However, in another place in the LOAD statement I have:

LOAD

$(vAcadyear) as Year,

And that's not working as I want. In this case, it evaluates the variable, and gives me '1999' as 'Year' (i.e. 2016 minus 17!)

How do I get it to store this variable as a string, even though it "looks" like a calculation.

Thanks,
Jess

1 Solution

Accepted Solutions
tyagishaila
Specialist
Specialist

try it,

LOAD

'$(vAcadyear)' as Year,

View solution in original post

16 Replies
ggallina
Creator III
Creator III

Hi!

Sorry, I dont understand:

LOAD

$(vAcadyear) as Year

Do you mean that you use the value 2016-17?

Is it possible to have the script or a sample app?

jessica_webb
Creator III
Creator III
Author

Yes, I would now expect the field 'year' to have the value '2016-17'

At the moment, it gives me the value '1999' which is wrong.

albi_prakash
Creator II
Creator II

Hi Jessica,

  Could you check the source field format? I guess there is some mis match in the format.

-Jai

PrashantSangle

Hello,

try with double quotes

like

"$(vAcadyear)" as Year


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
jessica_webb
Creator III
Creator III
Author

Hi Jai,

I'm afraid I don't understand what you mean.

ggallina
Creator III
Creator III

With load inline work fine:

Set vAcadyear = '2016-17';

T:
LOAD * INLINE [
F1, F2
A, $(vAcadyear)
B, $(vAcadyear)
]
;

Can you try to write let = '2016-17'?

albi_prakash
Creator II
Creator II

Hi Jessica,

   Can you share the sample data, that look alike? (If Possible )

-Jai

jessica_webb
Creator III
Creator III
Author

Hi Prashant,

That gives me the following error:

Field not found - <2016-17>

Centre_data:

LOAD

"2016-17" as Year,

ggallina
Creator III
Creator III

Jessica, try with let = '2016-17', it work.