Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Comparing filelist to table on load

Hi

I am (incrementally) loading data from CSV-files, located in different folders.

Each day, more (hundreds of) csv-files will be added to these folders, and they will not (cannot) be (re)moved after load.

To loop through the folders I am using the "Sub DoDir(Root)" from the user's guide

And the using:

// CODE

For Each File In FileList  ('$(FileRoot)')

          LOAD...

          variable_1,

          variable_2,

          etc...

          Form [$(File)](txt)

     <lots of code and reloads follows>

Next File

// CODE END

to load data from the csv-files therein.

NOW - I also have a qvd-file with a table with the names of the files previously processed.

Fileldname is Previous_filenames

What I need to do is to compare the filename of each csv-file to the list of previously loaded files, and only load the ones not previously loaded.

Something like:

If not exists(Previous_filenames, Filename('$(File)') Then...

Any ideas?

1 Solution

Accepted Solutions
whiteline
Honored Contributor II

Re: Comparing filelist to table on load

You've already done half of it, assigned a name.

Now create a field Previous_filenames, just add it to your LOADs:

LOAD...

          variable_1,

          variable_2,

  SubField('$(File)', '\', Substringcount('$(File)')+1) as Previous_filenames

Form [$(File)](txt)

1 Reply
whiteline
Honored Contributor II

Re: Comparing filelist to table on load

You've already done half of it, assigned a name.

Now create a field Previous_filenames, just add it to your LOADs:

LOAD...

          variable_1,

          variable_2,

  SubField('$(File)', '\', Substringcount('$(File)')+1) as Previous_filenames

Form [$(File)](txt)

Community Browser