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: 
Not applicable

How to split a text in Script??

Good day

I have a data that gives me as below:

InvoiceSupplierCode
1458-1459US054211
1460-1461-1462US054212

Is there any formula that i can split these Invoice number by the character of " - "??

It should be looks like this:

InvoiceSupplierCode
1458US054211
1459US054211
1460US054212
1461US054212
1462US054212

Tks in advance!

1 Solution

Accepted Solutions
MayilVahanan

HI

Try like this

Load *,SubField(FieldName,'-') as fieldname from table;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

HI

Try like this

Load *,SubField(FieldName,'-') as fieldname from table;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CELAMBARASAN
Partner - Champion
Partner - Champion

Use SubField()

like

Load SubField(Invoice,'-') AS Invoice, Supplier,Code

From datasource;

Info about SubField:

subfield(s, 'delimiter' [ , index ] )

In its three-parameter version, this script function returns a given substring from a larger string s with delimiter 'delimiter'. index is an optional integer denoting which of the substrings should be returned. If index is omitted when subfield is used in a field expression in a load statement, the subfield function will cause the load statement to automatically generate one full record of input data for each substring that can be found in s.

In its two-parameter version, the subfield function generates one record for each substring that can be taken from a larger string s with the delimiter 'delimiter'. If several subfield functions are used in the same load statement, the Cartesian product of all combinations will be generated.

Not applicable
Author

Tks a lot.