Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

pavendhan
New Contributor II

Create script table

Hi,

I have data like

No:111

Name:aaaa

No:222

Name:bbb

No:333

Name:ccc

No:444

Name:ddd

The result, I need

NoName
111aaaa
222bbb
333ccc
444ddd

Hope someone help me

Thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: Create script table

like this?

1.png


tmp:

load rowno() as Id, subfield(row, ':', 2) as Field  inline [

row

No:111

Name:aaaa

No:222

Name:bbb

No:333

Name:ccc

No:444

Name:ddd

];

final:

load Id, Field as No Resident tmp where Odd(Id);

join (final) load Id -1 as Id, Field as Name Resident tmp where not Odd(Id); 

drop table tmp;

11 Replies

Re: Create script table

Script:

Table:

LOAD * Inline [

No., Name

111, aaaa

222, bbb

333, ccc

444, ddd

];

Output:

Capture.PNG

pavendhan
New Contributor II

Re: Create script table

I need to loop through the data automaticaly

Re: Create script table

Not sure I understand what you mean. Can you elaborate your requirement?

pavendhan
New Contributor II

Re: Create script table

if we have thousand of rows,

for example:

Loop through from first line to end

Loop start

take No(111)

take Name

Loop end(aaaa)

after 222 etc..

Re: Create script table

Why do you need to loop, why can't you do a simple load? Is data structured in a way that a regular load won't work? You need to provide some details in order to get what you are looking for.

Best,

Sunny

pavendhan
New Contributor II

Re: Create script table

I have external notepad file having data like

No:111

Name:aaaa

No:222

Name:bbb

No:333

Name:ccc

No:444

Name:ddd

etc.....

I have to load all data into table.

The table with columns like

No,Name

111,aaaa

222,bbb

.

.

etc....

if we give the notepad file path, The data should loaded automatically and generate the table as I expected.

Thanks

MVP
MVP

Re: Create script table

like this?

1.png


tmp:

load rowno() as Id, subfield(row, ':', 2) as Field  inline [

row

No:111

Name:aaaa

No:222

Name:bbb

No:333

Name:ccc

No:444

Name:ddd

];

final:

load Id, Field as No Resident tmp where Odd(Id);

join (final) load Id -1 as Id, Field as Name Resident tmp where not Odd(Id); 

drop table tmp;

pavendhan
New Contributor II

Re: Create script table

Now its working .

Thanks to all

Pav

Re: Create script table

If you got what you wanted, please mark Massimo's‌‌ answer as correct answer to close this thread.

Best,

Sunny

Community Browser