PA_GetFieldName

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

version 2003


PA_GetFieldName (tableNum; fieldNum; fieldName)

ParameterTypeDescription
tableNumshortTable number
fieldNumshortField number
fieldNamechar *Field name

Description

The routine PA_GetFieldName returns in fieldName the name of the field whose table and field number are tableNum and fieldNum.

NOTE: This entry point cannot be used for SubFields.

tableFieldNames is a C or a Pascal string, depending of previous call to PA_UsePStrings or PA_UseCStrings.

Example

Build an array of field names for a table.

   void BuildFieldNamesArray (short tNum, PA_Variable *aNames)
   {
      Str255      name; // USING Mac Pascal STRINGS IN THIS SAMPLE
      register long   i;
      short         count;
      
   // Do nothing if the array has a bad type
      if(theArray->fType != eVK_ArrayString)
         return;
   // Get the number of fields
      count = PA_CountFields(tNum);
      if(PA_GetLastError() != eER_NoErr)
         return;
   // Resize the array
      PA_SetArrayNbElements(*aNames, count);
   // Fill it with field names
      for(i = 1; i <= count)
      {
         PA_GetFieldName(tNum, i, name);
         PA_SetStringInArray(*aNames, i, name);
      }
   }

See Also

PA_CountFields, PA_GetTableName.

Error Handling

Use PA_GetLastError to see if an error occurred (bad table number, bad field number).


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