Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
March 26 at 10am ET: See how Qlik drives growth and value in ISV segment - REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
shyamcharan
Creator III
Creator III

Truncating at a special character '~'

Hi Experts,

I have a requirement where I need to build a drill down object for a chart.

However, I need to use a column that has values as shown below. The values separated by '~' will fall into different levels of hierarchy.

The values in the column would have more than 3 level. But I would have to retract only first three levels of values and put each in a different field.

For Example:

Tree Column:

Earth~Country~State~City

Level1 Value~Level2 Value~Level3 Value~Level4 Value  


Expected Result:

Field 1:

Earth

Level 1 Value


Fie ld 2:

Country

Level 1 Value   


Field 3:

State

Level3 Value


Thanks in advance for the help.


Regards,

Shyam.                                

1 Solution

Accepted Solutions
sunny_talwar

Looking for this?

Capture.PNG

Script:

Table:

LOAD * Inline [

Earth~Country~State~City

Level1 Value~Level2 Value~Level3 Value~Level4 Value

];

OutputTable:

LOAD SubField([Earth~Country~State~City], '~', 1) as Earth,

  SubField([Earth~Country~State~City], '~', 2) as Country,

  SubField([Earth~Country~State~City], '~', 3) as City

Resident Table;

DROP Table Table;

View solution in original post

4 Replies
sunny_talwar

Looking for this?

Capture.PNG

Script:

Table:

LOAD * Inline [

Earth~Country~State~City

Level1 Value~Level2 Value~Level3 Value~Level4 Value

];

OutputTable:

LOAD SubField([Earth~Country~State~City], '~', 1) as Earth,

  SubField([Earth~Country~State~City], '~', 2) as Country,

  SubField([Earth~Country~State~City], '~', 3) as City

Resident Table;

DROP Table Table;

shyamcharan
Creator III
Creator III
Author

Thanks Sunindia.

This is what exactly I was looking for. Thanks heaps.

sunny_talwar

No problem

I am glad I was able to help.

Best,

Sunny

sunny_talwar

shyamcharan‌ I recommend closing this thread, if you have got the answer you were looking for, by marking correct answer.

Best,

Sunny