-
Re: Dataload - Importing only specific information from a list with the specific information.
Felip Drechsler Dec 19, 2017 1:56 PM (in response to Daniel Sørensen)Hi Daniel,
I've built something real quick that might be what you need.
The attached zip file contains 3 things:
- Meter_Parameter.xlsx contains the parameters you want to use
- Folder with some subfolders and csv files to simulate your needs
- QVW containing the load code
Extract all to a folder you like and run the QVW.
A brief description of the code would be
The Meter_Parameter file fields are:
MeterList, MeterMeasure and MeterUtility are your defined values
Folder is the subfolder inside the provided 'Sample Directory' folder.
// Loads the parameters from Meter_Parameters
data:
LOAD
// Key field is used to get complete filename to search for
MeterList & MeterMeasure & Folder as Key,
MeterList,
MeterMeasure,
MeterUtility,
Folder
FROM
[C:\Users\felipe.lourenco\Desktop\Meter_Parameters.xlsx]
(ooxml, embedded labels, table is Plan1);
// for all parameters contained in the Meter_Parameters file
for i = 0 to NoOfRows('data')-1
// gets fields from the above loaded table
let vLookUpDirectory = peek('Folder',$(i),'data');
let vLookUpUtility = peek('MeterUtility',$(i),'data');
let vLookUpKey = peek('Key',$(i),'data');
Data:
LOAD
'$(vLookUpKey).csv' as FileOrigin,
Order,
Date,
Supplier,
Part,
Quantity,
Value,
Utility
FROM
// dollar ($) expansion is used to get the specified file defined by vLookUpKey in vLookUpDirectory
[Sample Directory\$(vLookUpDirectory)\$(vLookUpKey).csv]
(txt, codepage is 1252, embedded labels, delimiter is ';', msq)
// condition to filter the current file being loaded.
where Utility = '$(vLookUpUtility)';
next i;
-
SampleQlikCommunity.rar 140.9 K
-