Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

explination?

subfield([qvd source],'\',substringcount([qvdsource],'\')+1)

what it do ?

1 Solution

Accepted Solutions
JonnyPoole
Former Employee
Former Employee

The expression appears to be grabbing the file name from a fully qualified file location.  Here are 2 examples of what this expression would return.

[qvd source]                subfield([qvd source],'\',substringcount([qvdsource],'\')+1)

----------------------------------------------------------------------------------------------------------

c:\temp\file.qvd              file.qvd

c:\temp\test\file2.qvd     file2.qvd

View solution in original post

4 Replies
Not applicable
Author

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'

from Qlik help

JonnyPoole
Former Employee
Former Employee

The expression appears to be grabbing the file name from a fully qualified file location.  Here are 2 examples of what this expression would return.

[qvd source]                subfield([qvd source],'\',substringcount([qvdsource],'\')+1)

----------------------------------------------------------------------------------------------------------

c:\temp\file.qvd              file.qvd

c:\temp\test\file2.qvd     file2.qvd

Not applicable
Author

Hi,

Source is like //abc/cde/ghi

substringcount(source,'/') it will give 4

then subfield(source,'/',4+1(5))

suppose here we have like this subfield([qvd source],'\',substringcount([qvdsource],'\'))

subfield(source,'/',4)  that is subfield(source,'/',4) it will give ghi