BulkUpdateIndexes function
Syntax
BulkUpdateIndexes([StringFieldArray])
Description
Use BulkUpdateIndexes to update indexes (PSINDEXDEFN table) for records that contain a field whose NotUsed setting has changed.
A field whose NotUsed flag has been set to True does not show up in indexes. The only way to modify a field's NotUsed setting is through an API call such as in the following example:
SetDBFieldNotUsed(FIELD.OrgId, True);
The indexes of records that contain this field need to be updated to reflect the new settings.
Information about this operation can be logged by turning on PeopleCode tracing of internal functions (value 256.)
Parameters
| Parameter | Description |
|---|---|
|
StringFieldArray |
Specify an array of field names (as strings), such as DEPTID, representing the fields whose NotUsed flag has been modified. Only the records containing these fields are updated. If you do not specify a value for this parameter, the indexes for all records are rebuilt. |
Returns
A constant value. The values are:
| Value | Description |
|---|---|
|
%MDA_Success |
Bulk operation completed successfully. |
|
%MDA_Failure |
Bulk operation did not complete successfully. |
Example
The following example uses the function without the optional array of field names:
&ret = BulkUpdateIndexes();
If (&ret = %MDA_Success) Then
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes succeeded");
Else
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes failed");
End-If;
The following example uses the function with an array of two field names passed to it:
&ret = BulkUpdateIndexes(CreateArray("DEPTID","PROJECT"));
If (&ret = %MDA_success) Then
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes succeeded");
Else
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes failed");
End-If;
Considerations Using this Function
Do not invoke this function from runtime pages, as it modifies all records, including the records used to support the page it is invoked from. This function should be invoked from a Application Engine program.
Note:
If you do call this function from a page the operation completes successfully, but the page returns an error message. Switching to a new component clears up this error, however, any changes not saved to the database are lost.
This function is intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not supported. Changes to data definitions are not recognized on currently loaded component. In general, changes aren't recognized until the component is reloaded.
Bulk operations are time consuming, therefore, referencing the log file to see the progress of an operation is recommended. These operations accommodate errors and continue processing, logging the overall progress of the operation.
Calling this function without any parameter rebuilds the indexes for all records, an operation that may take hours. By indicating a list of fields whose NotUsed flag has changed, only the affected records have their indexes updated, reducing the time required to run this function.
WARNING:
These operations take place in a separate transaction from the page's save status: the initiation of any of these operations immediately changes the definitions, even if the page is subsequently cancelled.