GetFieldType method: Business Interlink class
Syntax
GetFieldType(index)
Description
Use the GetFieldType method to support dynamic output. It returns the type of field specified by index. You can use this method only after you have used the MoveFirst method: otherwise the system doesn’t know where to start.
Note:
This method can also be used with hierarchical doc data.
Parameters
| Parameter | Description |
|---|---|
|
index |
Specify the number of the field you want to find the type of. |
Returns
A number indicating the type of the field. The values are:
| Value | Description |
|---|---|
|
1 |
String |
|
2 |
Integer |
|
3 |
Float |
|
4 |
Boolean |
|
5 |
Date |
|
6 |
Time |
|
7 |
DateTime |
|
8 |
Binary |
|
9 |
Object |
Example
In the following example, the Business Interlink object name is &MYBI. The example uses MoveFirst to move to the first row of the output buffer, and to the first column, or first field, in that row. The Repeat loop uses MoveNext to go through every row in the output buffer. The For loop processes every field in every row, using the GetFieldCount method to get the number of fields, or outputs, in the row. Within the For loop, GetFieldType gets the type of the field data (string, integer, and so on.)
/* Add inputs to the Business Interlink object, then call Execute
to execute the Business Interlink object.
You are then ready to get the outputs using the following code. */
If (&MYBI.MoveFirst()) Then
Repeat
For &I = 1 to &MYBI.GetFieldCount
&TYPE = &MYBI.GetFieldType(&I);
Evaluate &TYPE
Where = 1
&STRING_VARIABLE = &MYBI.GetFieldValue(&I);
/* test for and process other field types */
End-Evaluate;
End-For;
Until Not(&MYBI.MoveNext());
Else
/* Process error - no output buffer */
End-If;