Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
sebbyvogel123
Contributor II
Contributor II

Divide words from data field into multiple lines

Dear Community,

I have the data field "Rule". This includes f.e. ((user.userId="user1" or user.userId="user2")). In form of a table, it looks like this:

IDRule
123456((user.userId="user1" or user.userId="user2"))
999999(user.userId="user1" or user.userId="user6"))

 

My goal is to split these users and write each in a separate line. It should look like this:

IDUserID
123456user1
123456user2
999999user1
999999user6

 

Is there somebody who can help me?

Thanks in advance.

 

Labels (4)
1 Solution

Accepted Solutions
hector
Specialist
Specialist

Hi

Using the subfield without the third parameter gives you the result what you want

LOAD
	ID,
	Rule,
	textbetween(SubField(Rule,' or '),'"','"') as RuleSplit
INLINE [
    ID, Rule
    123456, '((user.userId="user1" or user.userId="user2"))'
    999999, '(user.userId="user1" or user.userId="user6"))'
];

 

and then with the textbetween() function you can cleanup the string.

hope it helps.

kind regards 

View solution in original post

2 Replies
hector
Specialist
Specialist

Hi

Using the subfield without the third parameter gives you the result what you want

LOAD
	ID,
	Rule,
	textbetween(SubField(Rule,' or '),'"','"') as RuleSplit
INLINE [
    ID, Rule
    123456, '((user.userId="user1" or user.userId="user2"))'
    999999, '(user.userId="user1" or user.userId="user6"))'
];

 

and then with the textbetween() function you can cleanup the string.

hope it helps.

kind regards 

sebbyvogel123
Contributor II
Contributor II
Author

Thats it.

Thank you very much. 🙂