| EXTRACT | Index Level | FILE |
| Syntax | FIELD( string.expression, search.delimiter, num.expression ) |
| Category | BASIC |
| Type | Function |
| 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. |
| Options | |
| See Also | statements & functions string.expression num.expression COL1() COL2() substring expressions PROCREAD substring field store substring extraction substring assignment TCLREAD functions |
| Example |
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". |
| Warnings | |
| Compatibility | D3 7.0 AP R83 |
| EXTRACT | Index Level | FILE |