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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

List values to many rows

In a database column, there are many values that are actually an array of values.  Each item in the array needs to be written out to a separate row in the target, a database in this case.
Example:
The source looks like:  A\n-B\n-C\n-
Which is actually an array:  [A, B, C]
This needs to be written out into 3 rows
A
B
C
Getting the source into an array may be handled using a JavaRow using:
String temp = input_row.housing_types.trim();
    String types[] = temp.split("\n- ");
    ArrayList<String> housingTypesList = new ArrayList<String>();
The problem I can't seem to figure out is how to get the values into separate rows.  It might be possible write the array out to a temp file and then read it back in as if it was a delimited file, but that is rather kulgy. 
Is there a way to write each element of the array into a separate row?
Many thanks in advance.

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Use a tJavaFlex.
I use a tJavaFlex for this sort of thing in this tutorial (https://www.rilhia.com/quicktips/quick-tip-row-multiplication). Look at the For Loop I use at step 2.

Hope it helps