Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

jrepucci15
Contributor

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?

Tags (2)
3 Replies

Re: create multiple rows in data load

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

MVP
MVP

Re: create multiple rows in data load

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
Esteemed Contributor III

Re: create multiple rows in data load

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,', ',','), ','), ' '), '/')