Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi
tell me about subfield with examples
why don't you look in help? or do you have further questions?
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 ';'
Simply Subfield works based on delimiter you can extract the string
it is very useful to extract the string from input data
ex:
Syntax: Subfield(Text,Delimitor,Position of extracted Part)
Ex: The below is my data which contains EmpID, Name, Age, i want to extract and display seperatly
03/ARUMAMAHESH/28
Now Subfield is very useful to work with this type data
Subfield('03/ARUMAMAHESH/28','/',1) gives the 03
Subfield('03/ARUMAMAHESH/28','/',2) gives the ARUMAMAHESH
Subfield('03/ARUMAMAHESH/28','/',3) gives the 28
Regards
ARUMAMAHESH
Hi,
Subfield helps you to
1- Break a string with delimiter into rows if used in script without positions number
2- It helps you to extract part of a string when positions is specified.
SubStringCount
Returns the number of times the string substring appears within the string text.
Hope this helps to simplify the two topics.