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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
lfalmoguera
Creator
Creator

Load a variable into a table...?

Hi all,

thanks a lot in advance.

I have a problem which I really do not understand an it has to be extremely simple...

I have this code...

which basically goes to a path, take every file and in a variable load the name of the register.

The problem is that I do not know how to store every name (the values I am storing in the variable into a table with just one field, the name of file).

Where is the fail?

let vVariable = '';

FOR EACH vFile IN FileList ('C:\Documents and Settings\cgi\Desktop\QV 10\CTO_VOD\CTO Vodafone\images\CTO\Projects' & '\*')
// You get the name of the file excluding the path
LET vFileName = Right('$(vFile)', Len('$(vFile)') - Index('$(vFile)', '', SubStringCount('$(vFile)', '')));

Names_Table:
LOAD
vFileName as Name;

next vFile;

Thanks a lot!

5 Replies
sparur
Specialist II
Specialist II

Hello,

it's quite simple:

Names_Table:
LOAD
'$(vFileName)' as Name

AUTOGENERATE 1;

lfalmoguera
Creator
Creator
Author

Did not work,

but this one did!


Thanks a lot anyway!

Table_Projects_Jpgs:
load * inline [imageName
'$(vNameFile)'];

sparur
Specialist II
Specialist II

very strange.

I always use such approach

lfalmoguera
Creator
Creator
Author

Thanks a lot Sparur.

Now I am having other issue.

I have names like test1.jpg, test2.bmp, test3.jpeg.

Anyway I can get rid of the point and that comes after the name?

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

You need to use function INDEX() to find the position of the dot in the string and then use the result inside function LEFT() to cut out the part that you need. Something like this:

LEFT( NAME , INDEX(NAME, '.', -1) - 1)

The function INDEX(NAME, '.', -1) returns the last position of a dot in the NAME (assuming that you might have more than one dot in a file name)

cheers,

Ask me about Qlik Sense Expert Class!