Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

String within string

Hello all,

I have a small problem.

I'm pretty new with qlikview, and I'd appreciate your help.

I have a values in table that is a path to a file.

Ex: c:\qlikview\projects\testOne\some other files

      c:\qlikview\projects\testTwo\some other files

      c:\qlikview\projects\testFive\some other files

I would like to extract the part between projects\ and \some other files.

Because it is not always the same number of characters, i do not know how to do it.

Please help

1 Solution

Accepted Solutions
Not applicable
Author

subfield("FieldName",'\',4) should return testOne, or testTwo etc.

Where "FieldName" is the name of the field containing your strings

View solution in original post

7 Replies
Not applicable
Author

subfield("FieldName",'\',4) should return testOne, or testTwo etc.

Where "FieldName" is the name of the field containing your strings

Not applicable
Author

Where will you be using these new strings?

Not applicable
Author

Could you explain please how it works?

Not applicable
Author

I'll use it like a field that can be selected.

Not applicable
Author

Here is the syntax from the QlikView Help docs:

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.

for example subfield('c:\qlikview\projects\testOne\some other files','\,4) will return the string 'testOne'

Not applicable
Author

Thanks, you are the best

Not applicable
Author

No problem! Good luck