Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mustafaelryah
Creator
Creator

How to load from multiple text files

Dear All,

I need to load data from many files to one table,

first file name is Transactions All.txt

2nd name is       Transactions Methaq.txt

when I load it as4

load....from 

(txt, codepage is 1256, embedded labels, delimiter is '\t', msq);

its show me error, how can I solve that plz.

1 Solution

Accepted Solutions
Colin-Albert

You cannot combine the preceeding load that is doing the applymap inside a loop.

Load the data in the loop into a temp table first, then use a resident load to generate the final table with the applymap and other commands.

Your example was posted as an image so the complete script is not available to view or copy. It is better to post scripts as text.

Try something like this

Set vConcatenate = ;
For Each vFile in FileList('D:\QlikView\Transaction*.TXT')

     tmpTable:
     $(vConcatenate)
     Load *,
     FileName() as FileName
     From  "$(vFile)"
     (
txt, codepage is 1256, embedded labels, delimiter is '\t', msq);
     Set vConcatenate = Concatenate ;
Next vFile ;


FinalTable:

load

    text(company) & '-' & Text(BranchObject) as #Company ,

     // add more commands here

     *

resident tmpTable ;


drop table tmpTable ;


View solution in original post

16 Replies
sunny_talwar

Does the two files follow the same structure and include the same fieldnames?

For difference due to fieldnames or structure, try a for loop:

Load multiple excel files from Multiple excel sheetsinto QV

For each..next ‒ QlikView

Chanty4u
MVP
MVP

mustafaelryah
Creator
Creator
Author

Sure, Same in every thing

sunny_talwar

There is no 's' in the file names, could that be the issue?

load....from  - > load....from 

Colin-Albert

It may be better to create a loop to do the reload rather than using the wildcard *.

If you use a loop, you can add a trace command to list which file is currently being processed and this may help identify the error, whereas the wildcard load does not identify which file is being processed.

It may be that one of the files differs from the others - using a loop would identify this.

hic
Former Employee
Former Employee

The wildcard in the file name usually works - but not always. Then it is better to use a For - Next loop:

Set vConcatenate = ;
For Each vFile in FileList('D:\QlikView\Transaction*.TXT')
$(vConcatenate)
Load *,
FileName() as FileName
From  "$(vFile)"
(
txt, codepage is 1256, embedded labels, delimiter is '\t', msq);
Set vConcatenate = Concatenate ;
Next vFile

HIC

HirisH_V7
Master
Master

Hi,

Showing error means!

what is the error?

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
mustafaelryah
Creator
Creator
Author

Sorry, the files contains s

Transactions All,

Transactions Methaq

and still I have the error

sunny_talwar

What is the error you are getting? Can you share the logfile?