Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
avastani
Partner - Creator III
Partner - Creator III

Using a variable in Data Connection

is it not possible to reference a variable in the data connection in the lib:// definition?

would like to do

http://URL/$(variable) in my connection but get an Internal Error

3 Replies
Anonymous
Not applicable

Maybe create a lib connection for http://URL called say YourURL and then use it the script as :

     [lib://YourURL]/$(variable)

Thus adding your variable to the end of the lib connection within the script.

arixooo123
Creator III
Creator III

Hi Bill,

I do have the same issue here, I ran below script but had an  issue.. I'll be grateful if you check and let me know

for each vFile in FileList('lib://QlikData/*.qvd')

        

Files:

Load '$(vFile)' as FName,

FileTime( '$(vFile)' ) as FileTime

autogenerate 1;

next vFile

LatestFile:

first 1

Load

FName,

FileTime,

1 as dummy

Resident Files

Order By FileTime DESC;

drop table Files;

          Let vMaxFile=FName;

   

Consignments:   

Load * from [lib://QlikData/'$(vMaxFile)'](qvd);

It doesn't load any file, the error  is :

The following error occurred:

Cannot open file: 'lib://QlikData/'''

Anonymous
Not applicable

I suspect the issue with line :

    Let vMaxFile=FName;

You probably need to use the peek() function, maybe something like :

    let vMaxFile= peek('FName',0,'LatestFile');

Also you could use Trace to check what is actually stored in the variable :

    Trace vMaxFile: $(vMaxFile) ;