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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Meallly
Contributor
Contributor

Duplicate rows based in ocurrences in a field

Hello

I have a table of questions and answers from an account.
Some questions are multi choice and I would like to have a line for each of them.

For example:
QUESTION ID, ANSWER
1, Yes
2, No
3, 1^5^10

For question 3, it is a multi-choice question where the user has selected 3 answers.

I would like to obtain the following final table:

QUESTION ID, ANSWER
1, Yes
2, No
3, 1
3, 5
3, 10

How could I get it?

Labels (1)
1 Solution

Accepted Solutions
Lisa_P
Employee
Employee

You could do this in the load script:

Data:
Load *,
Subfield(ANSWER, '^') as NEWANSWER;
Load * Inline [
QUESTION ID, ANSWER
1, Yes
2, No
3, 1^5^10
];

It would result in this in the data load:

Lisa_P_0-1713308827018.png

 

View solution in original post

2 Replies
Lisa_P
Employee
Employee

You could do this in the load script:

Data:
Load *,
Subfield(ANSWER, '^') as NEWANSWER;
Load * Inline [
QUESTION ID, ANSWER
1, Yes
2, No
3, 1^5^10
];

It would result in this in the data load:

Lisa_P_0-1713308827018.png

 

Meallly
Contributor
Contributor
Author

It works! Thank you so much!!