PA_GetTableAndFieldNumbers

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_GetTableAndFieldNumbers (tableFieldNames; tableNumPtr; fieldNumPtr)

ParameterTypeDescription
tableFieldNameschar *Valid table & field names
tableNumPtrshort *Table number or 0
fieldNumPtrshort *Field number or 0

Description

The routine PA_GetTableAndFieldNumbers returns into the shorts pointed to by tableNumPtr and fieldNumPtr the table and field numbers for the table/field name specified by tableFieldName.

NOTE: This entry point cannot be used for SubFields.

A table name or a field name is passed using the 4th Dimension Language syntax, e.g. the name of the table enclosed by square brackets and optionally followed by the name of the field. For Example:

Invoices is an invalid table name while [Invoices] is a valid table name,

Customer ID is an invalid field name while [Invoices]Customer ID is a valid field name.

If the name of the field is incorrect or not specified, *fieldNumPtr is returned equal to 0. If the name of the table is incorrect *tableNumPtr is also returned equal to 0. For these cases the entry point returns no error.

tableFieldNames is a C or a Pascal string, depending on previous calls to PA_UsePStrings or PA_UseCStrings.

Example

Wrapping PA_GetTableAndFieldNumbers to return an error if there is no square brackets:

   short WrapGetTableFieldNumbers (char *name, short *tNum, short *fNum)
   {
      *tNum = *fNum = 0;
   // In this sample, we are using C strings
      if( (name[0] != '[') || (strchr(name, ']') == 0L) )
         return kMY_ERROR_BAD_SYNTAX;// defined in a header
      PA_GetTableAndFieldNumbers(name, tNum, fNum);
      return PA_GetLastError();
   }

See Also

PA_GetFieldName, PA_GetTableName.

Error Handling

Use PA_GetLastError to see if an error occurred


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next