Skip to main content
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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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,', ',','), ','), ' '), '/')