Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlikview to read different .csv files at the same time

Hi

I am using QV for sports analysis reports

Currently, I get data from 2 separate sources which export the data as .csv files

For csv file 1, I use the following to import the csv

FROM

[$(vPATH)\*.csv]

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

This does not pick up csv file 2

For csv 2 I have to use the following to import the csv (When using this path, QV does not pick up csv file 1

FROM

[$(vPATH)\*.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Is there a way for QV to pick up both types of CSV files I Have attached samples of both csv files

4 Replies
nagireddy_qv
Creator II
Creator II

Hi

I think ,its not possible . you have to load one by one only..

t_chetirbok
Creator III
Creator III

Hello!

So, why are you can't load from both files and concatenate it?

load *

FROM

[$(vPATH)\FILE1.csv]

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

concatenate

load *

FROM

[$(vPATH)\FILE2.csv]

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

puttemans
Specialist
Specialist

Hi there,

Your path is the same, but is seems that the files are not similar as the third lie of code differs for both of them. If you can align them, you could load multiple csv-files one after another in the same script.

I have it in an application scripted by someone else, and it works fine. Below is the syntax, it may help you.

for each FileExtension in 'qvd'

  for each FoundFile in filelist( '$(vQVDPath)\Fact\'& 'Travel aggregate_*.' & FileExtension)

            Filelist:

            LOAD DISTINCT

                Class,

                %TempProdKey,

                [%Sales Channel]

            FROM [$(FoundFile)] (qvd);

    next FoundFile

  next FileExtension

Regards,

Johan

p_verkooijen
Partner - Specialist
Partner - Specialist

Hi

see Rob Wunderlich's post in this thread

https://community.qlik.com/t5/QlikView-Management/Load-Log-File-Encoding/m-p/884711?collapse_discuss...

"What I do is test the first character of the logfile with various encodings  to see if I can interpret it as a number. When I get a positive I use that encoding to read the file. Probably would break if someone used a MMM-DD-YYYY format, but haven't had a complaint (yet). Here's the relevant code that determines the encoding."

 

FOR EACH vEncoding IN 'utf8', 'unicode', 'codepage is 1252';

  TempCode:

  FIRST 1 // Log first row

  LOAD IsNum(left(@1:n,1)) as X // Test first char. Set to true if it's a number.

  FROM

  [$(_logpath)]

  (fix, $(vEncoding))

  ;

  EXIT FOR WHEN peek('X'); // If a number, assume we have the right encoding.

NEXT vEncoding;