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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

which function I can use?

Hello All

I have a field with values like below

1234-abc

13422-monday

136647536-tuesday

I need to display only the part before '-' 

eg) 1234  ,  13422,  136647536.

Kindly help me what function I can use to get above result.

Thanks in advance...

24 Replies
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Yes,U can use it in front end also.

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

better way is create in script level to use further .

Hope this help

ChennaiahNallani
Creator III
Creator III

Hi,


Use below script.


Tab:

LOAD * Inline [

FiledName

1234-abc

13422-monday

136647536-tuesday];

Tab1:

LOAD

KeepChar(FiledName,'0123456789') as FiledName1

Resident Tab;

sasiparupudi1
Master III
Master III

use Keepchar in your script

KeepChar(YourFiled,'0123456789') as YourFiled

Anonymous
Not applicable
Author

Where exactly in front end?? Please helo..

nizamsha
Specialist II
Specialist II

Hi

U can Use this if its suits ur scenario

=KeepChar('1234-abc',0123456789)

or

=SubField('1234-abc','-',1)

Anonymous
Not applicable
Author

You mentioned to use in expression. But the field is a dimension.

Anonymous
Not applicable
Author

Yes. Give me some time. I am trying the sokution. Will inform once it is sccessful..

Anonymous
Not applicable
Author

Hello Sunny

SubField(FieldName, '-', 1) as FieldName

Above is not working for me in the script.

Not applicable
Author

You can use the funciton SubField, check the attached document to see how it works.

Qlikview Help:

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.

Examples:

(For three parameters)

subfield(S, ';' ,2) returns 'cde' if S is 'abc;cde;efg'

subfield(S, ';' ,1) returns NULL if S is an empty string

subfield(S, ';' ,1) returns an empty string if S is ';'