Global Search and Replace

Description

Search and replace values in a field in all currently visible rows in the Grid.

Used with the Grid component

 Javascript placed in 'OnPush' attribute

var rowNum = {grid.object}._selectedRow;
{grid.Object}.globalUpdate(rowNum,{
	fieldToUpdate: '',
	elementIdSearchValue: '',
	elementIdReplaceValue: '',
	rowsToUpdate: 'AllVisibleRows',
	promptForConfirmation: false,
	confirmationMessage: 'OK to change value in row [row] from \'[old]\' to \'[new]\'?',
	allInstances: true,
	caseInsensitive: true,
	type: 'search'
});

 Search and Replace Operation Properties

Field to update

Specify the field to update. You can use <CurrentField> to indicate the field that currently has focus. Choices include.

Read 'search' value from

Specify the ID of an element from which the 'search' value will be read.

Read 'replace' value from

Specify the ID of an element from which the 'replace' value will be read.

All instances in field

Replace all instances of the search phrase. If unchecked, only the first instance is changed.

Case insensitive

Specify if the search should be case insensitive.

Rows to update

Specify which rows should be updated. 'AllVisibleRows' - all visible existing record rows and all new record rows, 'AllVisibleExistingRecordRows' - all visible existing record rows, but not new record rows. 'AllNewRecordRows' - only new record rows. 'CheckedRows' - only rows that have been checked. Choices include.

Prompt for confirmation

Before updating a non-blank value, prompt for confirmation?

Confirmation message

Specify the template to use for the confirmation message. The message can include these placeholders: [row] - row number, [old] - old value in field, and [new] - new value for field.

 Videos

Global Search and Replace in a Grid Component

When doing data entry into a Grid there may be times when the user wants to perform a search and replace operation on the data the currently visible rows in the Grid. Using Action Javascript, it is easy to make a button does a 'global search and replace' on all visible rows in the Grid.

It is important to recognize that the action shown in this video is a 'client-side' action. No data is actually written to the database until the user clicks the 'Submit' button.

See Also