|Command||basic.field Function/BASIC Program
Applicable release versions: AP, R83
|Category||BASIC Program (486)|
|Description||returns a substring from a string expression, by specifying a delimiter and the desired occurrence.
The "occurrence" is the number of delimiters to be skipped, minus one, prior to extraction of the substring. After executing the "field" function, the "col1()" and "col2()" functions return the beginning and ending positions within the string at which the delimiters were found.
The search delimiter is limited to a single character. Any additional characters are ignored.
|Syntax||field(string.expression, search.delimiter, num.expression)|
gl.account = "02*4000*11" company.code = field(gl.account,"*",1) This causes all characters up to the first asterisk in "gl.account" to be assigned to the variable "company.code". As a result, afterward, "company.code" contains the value, "02". "col1()" has a value of 0, and "col2()" has a value of 3. acct.number = field(gl.account,"*",2) This causes all characters from the first to the second asterisk to be stored in the variable, "acct.number". "acct.number" contains the value, "4000".