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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
abraham_paradac
Contributor III
Contributor III

How to use SubField Function

Im new here and I would like to make an simple example to Use SubField Funtion.

 

I Used in Load Script on Qliksense:

MyTable:
LOAD

TEXT(SubField("String",'-',1)) AS "Title Chars",
NUM (SubField("String",'-',2)) AS "Title Num",   // Delimiter is '-'  / Is not necesary declare on the script. And Separe the string (" Hello-123", in Title Chars: "hello" and  Title Num: "123"

 

I hope to help someone.

Best Regards

 

3 Replies
Anil_Babu_Samineni
MVP
MVP

What if string has like "Hello-World-123" ?? Or every time "Hello-123" only?

Use, Simple as much

MyTable:
LOAD
SubField("String",'-',1) AS "Title Chars",
SubField("String",'-',2) AS "Title Num";

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
consultant_bi
Creator
Creator

Hello

and you can use the LEFT and RIGHT functions too:

//Hello-123

MyTable:
LOAD

TEXT(left(string,index(string,'-')-1) AS "Title Chars",  // Hello
NUM (right(string,index(string,'-')+1) AS "Title Num", //123


abraham_paradac
Contributor III
Contributor III
Author

For Hello-World-123, you can do:

 

MyTable:
LOAD
SubField("String",'-',1) AS "Title Chars",

SubField("String",'-',2) AS "Title Chars2",

SubField("String",'-',3) AS "Title Num";

 

..Test  and comment us!