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

Loop files and variables

Hi there,

I've seen some some questions about this problem but they don't seem to suit my particular problem. I have the following issue. I have several data sources from separate business units. They all contain the same data fields and they need to be loaded in the same table but all need a qualifier within the table to retrieve the original source. So I have for two business units:

FUELACTIVITY.QVD

GASACTIVITY.QVD

with qualifiers

'Fuel'

'Gas'

The script for FUEL looks as shown below

T_ORDERS:
LOAD #OrderID,
    
ArgosCompany,
    
OrderDate,
    
CustomerLocation,
    
SUM(OrderQuantity) AS OrderQuantity
GROUP BY
 
#OrderID, ArgosCompany,OrderDate,CustomerLocation;
LOAD SiteId & DATE(ShiftDate,'DDMMYYYY') AS #OrderID,
           'Fuel'
AS ArgosCompany,
    
DATE(ShiftDate, 'DD-MMM-YYYY') AS OrderDate,
    
SiteId AS CustomerLocation,
    
IF(Activity = 'Load', LoadedQty, DeliveredQty) AS OrderQuantity
FROM
FUELACTIVITY.QVD
(
qvd)
WHERE(MATCH(Source,'DP','DC') AND ((Activity = 'Load' OR Activity = 'Delivery') AND (LoadedQty > 0 OR DeliveredQty > 0)));


How can I incorporate the looping over several files with qualifiers? If this can be done using an Inline load that would work perfect since there is only a limited number of business units but using an xls could also work. Thanks in advance!

Cheers Donald

Tags (1)
4 Replies
Not applicable

Loop files and variables

Hi,

Since you are using Flag column ArgosCompany, don't use qualifier. Go for concatenate.

Apart from this there are filelist() available.

HTH

Reg,

Shubhu

Not applicable

Loop files and variables

Hi Shubhu,

I just figured it out. And indeed the Qualifier is gone now. Thanks for the help!

Not applicable

Loop files and variables

Just one more question. Right now I'm using an inline statement with LET statements and variables for the Filenames. How would I populate a filelist?

gandalfgray
Valued Contributor

Loop files and variables

Search for filelist in the Help

there is an example in the for each..next

The easiest is if you can place your infiles in the same directory, and have some wildcard-string that will match all your filenames.

Community Browser