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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
heiko_schmidt
Contributor III
Contributor III

Loop in load statement

Hello everybody, I am facing the following problem:

I load this table:

SQL SELECT

     ordernumber,

    "t_seqe",

    "Text",

    FROM "qlik".dbo."Table";

In this table i have text fields per ordernumber

so the data set could be like this:

ordernumber 10   / "t_seqe" = 1  / Text = "Hello"

ordernumber 10   / "t_seqe" = 2  / Text = "World"


There could be one ordernumber with different sequenze numbers and the Text should be concatenated.

Sometimes i also have a sequenze number 3 or 4 aswell.

What I need at the end is this data set is:


ordernumber 10   / Text = "Hello World"


I hope anybody can help me with this.

Best regards

Heiko



6 Replies
raajaswin
Creator III
Creator III

Hi you can use concat function

Load

ordernumber,

concat(Text,' ',t_seqe) as Text_Converted

resident <your table> group by ordernumber;

agigliotti
Partner - Champion
Partner - Champion

what's your expected result?

heiko_schmidt
Contributor III
Contributor III
Author

Hello, the original data set is like this:

ordernumber 10   / "t_seqe" = 1  / Text = "Hello"

ordernumber 10   / "t_seqe" = 2  / Text = "World"

ordernumber 10   / "t_seqe" = 3  / Text = "!"

and my expected result is like this:


ordernumber 10   / Text = "Hello World!"


field  "t_seqe" (sequenze number) tells you into how many parts the text had been divided.

field value varries from 1 up to 5

agigliotti
Partner - Champion
Partner - Champion

I think what raajaswin‌ said above should works for you.

heiko_schmidt
Contributor III
Contributor III
Author

Great. It works. Thanks a lot.

jonathandienst
Partner - Champion III
Partner - Champion III

You could do it in a preceding load like:

LOAD

    ordernumber,

    Concat(Text, ' ', t_seqe) as CombinedText

    Group By ordernumber;

SQL SELECT

     ordernumber,

    "t_seqe",

    "Text",

FROM "qlik".dbo."Table";

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein