Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
arngue
New Contributor III

How to load filename as a column inside for loop in load script


Let vFile = '';

for each FoundFile in filelist( '.\txt\*.txt')

Let vFile = SubField(Text($(FoundFile)),'\txt\',2);

Table1:
Load
$(vFile)

 

Why this variable does not work?

image.png

 

for each FoundFile in filelist( '.\txt\*.txt')

Table1:
Load
SubField(‘$(FoundFile)’,'\txt\',2) as file,

image (1).png

I can't get this to work. I'm lost.

1 Solution

Accepted Solutions

Re: How to load filename as a column inside for loop in load script

Try this

Table1:
LOAD SubField('$(FoundFile)','\txt\',2) as file,

Your single quotes look like another type of quotes

2 Replies

Re: How to load filename as a column inside for loop in load script

Try this

Table1:
LOAD SubField('$(FoundFile)','\txt\',2) as file,

Your single quotes look like another type of quotes

Re: How to load filename as a column inside for loop in load script

How about simply doing?

Load FileName() as FileName From Table;

If you need your way, try this?

Let vFile = '';

for each FoundFile in filelist( '.\txt\*.txt')

LET vCount = NoOfRows('$(FoundFile)');

Table1:
Load
SubField($(FoundFile),'\txt\',2) as File

Autogenerate $(vCount);

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)