Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Read all new XML files in a directory and load data in tables/qvds

Hello,

In a 'Pre Load' script/qvw:

I will have XML extracts deposited into a directory on a server every few hours in order to track financials in a dashboard. I then want to loop through all of the files to grab any files that have been deposited since the last reload. These XML's will contain more information than is needed, so once I have all of the XMLs I want to load only specific data in to tables. Once I have the data, I will store it into QVDs.


Main script/qvw:

Run after the preload to pull all relevant data in from the QVDs to create the dashboard.


I need help with figuring out logic to bring in these XML files and grab the data. The file structure should be consistent across all XML files that are being deposited. Example file name   'QVExtract-20170125165444420.xml'

I am able to Load data properly by focusing on one specific file, but not sure how to loop to X number of files to Load my tables.


1 Reply
hector_munoz
Specialist
Specialist

Hi Jordan,

A typical FOR loop used in file loading would be:

SET cROOT        = '.\FILES_IN';

SET cFICHEROS_IN = 'FILES_IN.xml';

FOR EACH vsFile IN FileList('$(cROOT)' & '')

...

...

...

NEXT vsFile

I hope it serves to you...

Regards,
H