Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
dcd123456
Creator
Creator

generate multiple rows from on row in load script

Hello

I have a table with several field and i need split the original rows in  severals rows with only one field, in the load script.

for example i have the original table like this:

IDField1Impofield2impo
a2013100 €201410 €
b201310 €
c2014200 €201560 €

and i need transform this table in the load scrip to the next table:

IDFieldxImpo
a2013100 €
a201410 €
b201310 €
c2014200 €
c201560 €

anybody know how can i do this in the load scrip?

thanks

regards

1 Solution

Accepted Solutions
PrashantSangle

Hi,

As per my understanding this is not possible in one load

You have to split your load and conactenate it.

Try like

test:

LOAD * INLINE [
id, field1, Impo, field2, impo
a, 2013, 100, 2014, 10
b, 2013, 10
c, 2014, 200, 2015, 60
]
;

final_Test:
load id,
field1,
Impo
Resident test;

Concatenate
LOAD id,
field2 as field1,
impo as Impo
Resident test;

drop Table test;

Find attached application for more clearifiaction.

REgards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

4 Replies
tresesco
MVP
MVP

Try like:

Final:

Load    

          ID,

          Field1 as Fieldx,

          Impo

From <>;

Load

          ID,

          Field2 as Fieldx,

          impo as Impo

From <> where not isnull(Field2);  // this condition might vary accordinly.

         

It would give you one table 'Final' as expected.

aveeeeeee7en
Specialist III
Specialist III

Hi

Use this Script:

ABC:
LOAD * Inline [
ID, Field1, Impo, field2, impo
a, 2013, 100 €, 2014, 10 €
b, 2013, 10 €, ,
c, 2014, 200 €, 2015, 60 €
];

NoConcatenate
BCD:
LOAD
ID,
Field1,
field2,
Field1&'/'&field2 AS FieldKey,
Impo,
impo,
Impo&'/'&impo AS ImpoKey
Resident ABC;
DROP TABLE ABC;

NoConcatenate
CDE:
LOAD
ID,
Subfield(FieldKey,'/',1) AS FieldKey,
Subfield(ImpoKey,'/',1) AS ImpoKey

Resident BCD WHERE LEN(TRIM(Subfield(FieldKey,'/',1)))<>'0' AND LEN(TRIM(Subfield(ImpoKey,'/',1)))<>'0';

Concatenate(CDE)

LOAD
ID,
Subfield(FieldKey,'/',2) AS FieldKey,
Subfield(ImpoKey,'/',2) AS ImpoKey

Resident BCD WHERE LEN(TRIM(Subfield(FieldKey,'/',2)))<>'0' AND LEN(TRIM(Subfield(ImpoKey,'/',2)))<>'0';

DROP TABLE BCD;

The Final Result:

Final result.png

See the Attachment.

Regards

Av7eN

PrashantSangle

Hi,

As per my understanding this is not possible in one load

You have to split your load and conactenate it.

Try like

test:

LOAD * INLINE [
id, field1, Impo, field2, impo
a, 2013, 100, 2014, 10
b, 2013, 10
c, 2014, 200, 2015, 60
]
;

final_Test:
load id,
field1,
Impo
Resident test;

Concatenate
LOAD id,
field2 as field1,
impo as Impo
Resident test;

drop Table test;

Find attached application for more clearifiaction.

REgards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
dcd123456
Creator
Creator
Author

thanks to all

regards