|
![]() |
![]() |
version 2003
PA_RecordsInSelection (tableNum) → long
Parameter | Type | Description | |
tableNum | short | → | Table number |
Function result | long | ← | Number of records in the current selection |
Description
The command
PA_RecordsInSelection
returns the number of records in the current selection of the Table number
tableNum
.
A 4D plug-in most typically uses
PA_RecordsInSelection
after a query to determine the number of records return by the search command.
WARNING
This routine does not use virtual structure
Example
Walking through a selection (no error checking here):
void DoSomethingWithTheSelection (short tableNum)
{
register long i;
// Here, we do not want to activate the relations
PA_AutomaticRelation(0, 0);
// Loop for each record in the selection
for(i = 1; i <= PA_RecordsInSelection(tableNum); i++)
{
PA_Yield(); // Give time to other tasks
// load record i of the selection
PA_GoToSelectedRecord(tableNum, i);
/*
Do something with the record.
PA_SaveRecord can be called here.
*/
}
}
See Also
Error Handling
Use
PA_GetLastError
to see if an error occurred (invalid table number)