Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
sspawar88
Contributor II

How can we validate the .csv file on basis of information in .xlsx

Hi,

I have following excel Filestructure.xlsx

Filestructure.xlsx

FilenameFields
Data_Level_*.csvID
Data_Level_*.csvEMP_NAME
Data_Level_*.csvEMP_LOCATION
Data_Level_*.csvCODE


How can we validate the .csv in following folders on the basis of Filename and Fields?

if following csv files doesn't have filename standard and table structure which mentioned in Filestructure.xlsx Qlikview should give the information of compliance in txt

6 Replies
MVP
MVP

Re: How can we validate the .csv file on basis of information in .xlsx

Sorry can't work on whole question..

I can guide you though..

Load your file..

now use something as below

TMP:

NoConcatenate FIRST 1 LOAD * FROM YourFileName.xlsx;

IF FieldNumber (ID) = 0 then Trace....

IF FieldNumber (EMP_NAME) = 0 then Trace....

etc etc

sspawar88
Contributor II

Re: How can we validate the .csv file on basis of information in .xlsx

Sorry to ask you again ! Could you please explain little more?

MVP
MVP

Re: How can we validate the .csv file on basis of information in .xlsx

To validate the fieldname.. load the first line of table/file..

now use FieldNumber Function.. if that field exists then you will get >0 ..

Hope this will make clear..

Re: How can we validate the .csv file on basis of information in .xlsx

what information you want to give in text? like below ?

Number of fields not matched

There is additional column

Field names are different

sspawar88
Contributor II

Re: How can we validate the .csv file on basis of information in .xlsx

Hi Kushal,

Yes this information need to have in txt file.

Please share your approach that would be very helpful.

Re: How can we validate the .csv file on basis of information in .xlsx

another option to get a list of files and fields contained:

tabCSVFiles:

CrossTable (Field, Value)

LOAD FileName() as File,

    *

FROM [Data_Level_*.csv] (txt, utf8, embedded labels, delimiter is ',', msq)

Where RecNo()=1;

hope this helps

regards

Marco