Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakqlikview_123
Specialist
Specialist

loading file

PFA

I have below is a file format for CSv file

1~"Weekly Charts"~"Hotel Fundamentals"~"Industry Statistics"~"SA Real

Can you please suggest how should i load this.

Thanks

1 Solution

Accepted Solutions
saumyashah90
Specialist
Specialist

x:

LOAD

RowNo() as Unique,

[""Category""],

     [""Subcategory""],

     [""Dashboard""],

     [""Chart""],

     [""Line""],

     [""Sr_No""",,,,,,]

FROM

(txt, codepage is 1252, embedded labels, delimiter is '~', no quotes, no eof);

do this

if delimiter is  ~

LOAD

     [Unique_No~],

     Category,

     Subcategory,

     Dashboard,

     Chart,

     Line,

     Sr_No

 

FROM

[..\2.csv]

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

if delimeter is ""

View solution in original post

6 Replies
Anonymous
Not applicable

In the load script editor click on Table Files, select your file and follow the prompts.

sebastianlettner
Partner - Creator
Partner - Creator

Hi,

this should work:

LOAD

     [Unique_No~],

     Category,

     Subcategory,

     Dashboard,

     Chart,

     Line,

     Sr_No

  

FROM

[..\2.csv]

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

Regards

Sebastian Lettner

saumyashah90
Specialist
Specialist

x:

LOAD

RowNo() as Unique,

[""Category""],

     [""Subcategory""],

     [""Dashboard""],

     [""Chart""],

     [""Line""],

     [""Sr_No""",,,,,,]

FROM

(txt, codepage is 1252, embedded labels, delimiter is '~', no quotes, no eof);

do this

if delimiter is  ~

LOAD

     [Unique_No~],

     Category,

     Subcategory,

     Dashboard,

     Chart,

     Line,

     Sr_No

 

FROM

[..\2.csv]

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

if delimeter is ""

effinty2112
Master
Master

Hi Deepak,

I really think that whoever creates your csv should change how they do it. If you're stuck with that format try this load script:

RawHeader:

First 1

LOAD

@1 &

     @2 &

     @3 &

     @4 &

     @5 &

     @6 &

     @7 as Header

FROM

[2.csv]

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

FieldNames:

Load

'@' & RowNo() as RawField,

*;

Load

SubField(PurgeChar(Header,'"'),'~') as Header

Resident RawHeader;

DROP Table RawHeader;

FieldNameMap:

Mapping

LOAD

* Resident FieldNames;

drop Table FieldNames;

Data:

LOAD

  PurgeChar(@1, '"') as @1,

  PurgeChar(@2, '"') as @2,

  PurgeChar(@3, '"') as @3,

  PurgeChar(@4, '"') as @4,

  PurgeChar(@5, '"') as @5,

  PurgeChar(@6, '"') as @6,

  PurgeChar(PurgeChar(@7, '"'),',') as @7

FROM

[2.csv]

(txt, codepage is 1252, no labels, delimiter is '~', no quotes, filters(

Remove(Row, Pos(Top, 1))

));

RENAME Fields using 'FieldNameMap';

HirisH_V7
Master
Master

Hi Deepak,

You can load table like this,

Backend Script:

T:

LOAD

      TextBetween(["Unique_No],'"','') as UniqueNo,

     TextBetween([""Category""],'""','""') as Category,

     TextBetween([""Subcategory""],'""','""') as SubCategory,

     TextBetween([""Dashboard""],'""','""') as Dashboard,

     TextBetween([""Chart""],'""','""') as Chart,

     TextBetween([""Line""],'""','""') as Line,

     TextBetween([""Sr_No""",,,,,,],'""','""",,,,,,') as Sr_No

 

FROM

[\2.csv]

(txt, codepage is 1252, embedded labels, delimiter is '~', no quotes, no eof);

Front-end:

loading file.PNG

PFA,

Hope this Helps,

Regards,

HirisH

HirisH
“Aspire to Inspire before we Expire!”
Not applicable

‌Beautyful picture!))) Results?