|
![]() |
![]() |
version 2003
PA_SaveRecord (tableNum)
Parameter | Type | Description | |
tableNum | short | → | Table number |
Description
The routine
PA_SaveRecord
saves the current record of the table number
tableNum
, in the current process. If there is no current record, then
PA_SaveRecord
does nothing.
This routine does the same as the 4D command
SAVE RECORD
.
A call to
PA_SaveRecord
is usually performed after a call to
PA_CreateRecord
, or after having modified a record by using an other 4D PluginAPI routine such as
PA_SetxxxField
(where xxx is Integer, String, Boolean).
If the current record is locked by an other user or process,
PA_SaveRecord
does nothing. It is the 4D plug-in's responsibility to test the lock status of the record using the entry point
PA_IsLocked
before attempting to modify it.
The error checking is made by calling
PA_GetLastError
immediately after a call to
PA_CreateRecord
. Usually, if an error occurs, it will be because
tableNum
is out of range (
eInvalidFileNumber
).
Examples
(1) Creating and saving a record.
// ... some code ...
PA_CeateRecord(tableNum);
err = PA_GetLastError();
if(!err)
{
// ...Modifying fields values ...
PA_SaveRecord(tableNum);
err = PA_GetLastError();
}
return err;
(2) Modifying an existing record:
// ... some code ...
if(PA_IsRecordLocked(tableNum))
{
//return an error, alert user, do something, ...
}
else // The record is free, we can modify it
{
// ...Modifying fields values ...
PA_SaveRecord(tableNum);
err = PA_GetLastError();
}
return err;
See Also
PA_CreateRecord , PA_SetBooleanField , PA_SetTextField .
Error Handling
Use
PA_GetLastError
to see if an error occurred (most often
eInvalidFileNumber
).