Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jrepucci15
Creator
Creator

create multiple rows in data load

I have a data set that looks like similar to this

Request     Response

CR-1     F1,F2,F3,F4

CR-2     F5

CR-3     F6, F7

CR-4     F8 F9

CR-5     F10/F11

I want it to look like a row for each response

Request     Response

CR-1     F1

CR-1     F2

CR-1     F3

CR-1     F4

CR-2     F5

etc ...

I can handle the various delimiters and cases where the response data is not of the correct format (I hate free form entry fields!!), but I'm not sure how to expand single rows into multiple rows in the load statement.


Suggestions?

3 Replies
Anil_Babu_Samineni

Just use SubField() for your preceding load or please tell me the output for sample set

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
maxgro
MVP
MVP

1.jpg

Source:

load * inline [

Request |    Response

CR-1 |    F1,F2,F3,F4

CR-2 |    F5

CR-3 |    F6, F7

CR-4 |    F8 F9

CR-5 |    F10/F11

] (delimiter is '|')

;

Final:

load

  Request,

  //Response,

  SubField(Replace(Replace(Replace(trim(Response), ' ', ','), '/', ','), ',,', ','), ',') as ResponseNew

Resident Source;

DROP Table Source;

vishsaggi
Champion III
Champion III

Try this?

= Subfield(Subfield(Subfield(Trim(Response), ','),' '), '/')

OOps missed the space thing. Using Massimo's replace you can also write something like this:

= Subfield(Subfield(Subfield(Replace(Response,', ',','), ','), ' '), '/')