<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_FieldNum |
Declare Function sx_FieldNum Lib "Apollo9.dll"
(ByVal cpFieldName As String)
As Integer
SHORT FAR PASCAL sx_FieldNum
(BYTEP cpFieldName);
Gets number of named field in field array (relative to 1). This function is useful to test the validity of a field name.
cpFieldName: The name of the field.
The relative position of the field in the field array (relative to 1). If the field does not exist, zero is returned.
Sub bFieldData_Click ()
Dim FieldStr As String
inputTag:
FieldStr = InputBox$("Field Name?", "Get Field Data", "")
If FieldStr = "" Then Exit Sub
If sx_FieldNum(FieldStr) = 0 Then
MsgBox "Invalid field name"
GoTo inputTag
End If
tField.Text = sx_GetString(FieldStr)
Exit Sub
End Sub
// get field name and extract data
for (i = 0, j = 0; i <= lstrlen(lpFields); i++)
{
if (lpFields[i] == NIL || lpFields[i] == ';')
{
caFieldName[j] = NIL;
k = sx_FieldNum(caFieldName) - 1;
// ignore memo fields
if (CURRENTFIELD[k].cType != 'M')
{
if (CURRENTFIELD[k].cType == 'D')
{
if (cpRecBuffer[0])
lstrcat((LPSTR) cpRecBuffer, (LPSTR)
sx_GetDateString(caFieldName));
else
lstrcpy((LPSTR) cpRecBuffer, (LPSTR)
sx_GetDateString(caFieldName));
}
else
{
if (cpRecBuffer[0])
lstrcat((LPSTR) cpRecBuffer, (LPSTR)
sx_GetTrimString(caFieldName));
else
lstrcpy((LPSTR) cpRecBuffer, (LPSTR)
sx_GetTrimString(caFieldName));
}
lstrcat(cpRecBuffer, " ");
}
if (lpFields[i] == NIL)
break;
j = 0;
}
else
{
caFieldName[j] = lpFields[i];
j++;
}
}
sx_FieldCount, sx_FieldDecimals, sx_FieldName, sx_FieldOffset, sx_FieldType, sx_FieldWidth