Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

ilanbaruch
Contributor

varible into a field in script load

hi,

created a variable where the acript start and i want to create a field that will hold var. value is it possible??

1 Solution

Accepted Solutions
MVP
MVP

Re: varible into a field in script load

May be you need to format vToday variable little differently. What is the format of vToday right now?

I would try suggesting something like this:

LET vToday = Date(Today(), 'DD-MMM-YYYY');

Temp:

LOAD

'$(Variable_Name)' as Variable

AutoGenerate(1);

STORE Temp into $(vQVDLoadPath)Temp_$(vToday).qvd (qvd);

DROP Table Temp;

9 Replies
MVP
MVP

Re: varible into a field in script load

Yes, like

LOAD

     '$(vVar)' as Variable,

     ....

ilanbaruch
Contributor

Re: varible into a field in script load

thank you swuehl,

at the end of this load i want to store it to a qvd with a variable suffix..

tried it like:

Temp:

LOAD

'$(Variable_Name)' as Variable

AutoGenerate(1);

STORE Temp into $(vQVDLoadPath)Temp_$(vToday).qvd (qvd);

DROP Table Temp;

script failsSmiley Sad

any ideas?

MVP
MVP

Re: varible into a field in script load

May be you need to format vToday variable little differently. What is the format of vToday right now?

I would try suggesting something like this:

LET vToday = Date(Today(), 'DD-MMM-YYYY');

Temp:

LOAD

'$(Variable_Name)' as Variable

AutoGenerate(1);

STORE Temp into $(vQVDLoadPath)Temp_$(vToday).qvd (qvd);

DROP Table Temp;

MVP
MVP

Re: varible into a field in script load

Check the expanded variables in debug mode.

You can also enclose the file name and path in []:

STORE Temp into [$(vQVDLoadPath)Temp_$(vToday).qvd] (qvd);

alex_millan
Contributor III

Re: varible into a field in script load

Hi ilan,

if that may help, this script works properly, perhaps there's a problem when you declare your variables

Example:

     SET vVar1 = 'Test';

     LET vToday = Date(Today(),'YYYYMMDD');

     SET vQVDLoadPath = 'C:\Users\aaaaaaa\Desktop\Temp_Test\';

     Temp:

     LOAD '$(vVar1)' as Variable

     AutoGenerate(1);

     STORE Temp into $(vQVDLoadPath)Temp_$(vToday).qvd (qvd);

     DROP Table Temp;

HTH

Regards

jonas_rezende
Valued Contributor

Re: varible into a field in script load

Hi, ilan baruch.

See if the variable that contains the path is with backslash (\) at the end. Otherwise, add or explicit in into command.

Ex.:

Alternative 1:

SET vQVDLoadPath = '..\<foldername>\';

Alternative 2:

STORE Temp into $(vQVDLoadPath)\Temp_$(vToday).qvd(qvd);

Drop table Temp;

Hope this helps!

ilanbaruch
Contributor

Re: varible into a field in script load

anoter Q,

      LET vToday = DATE(Date#(ReloadTime()),'YYYYMMDD HH:MMSmiley FrustratedS');

any idea why this format dont work?

MVP
MVP

Re: varible into a field in script load

My guess is because of colon signs in there (Smiley Happy

Maybe try this if you need timestamp

LET vToday = TimeStamp(ReloadTime(),'YYYYMMDD_hhmmss'); Fixed based the format based on Stefan's comment below


MVP
MVP

Re: varible into a field in script load

try without the interpretation:

LET vToday = DATE(ReloadTime(),'YYYYMMDD hh:mm:ss);

Note that minutes are format coded by 'mm'.