# find-replace

The find-replace action enables data manipulation, you programmatically search for and replace string values within your local data tables or Dynamic Data tables. This action provides an efficient way to bulk update data across rows and columns without manual intervention.

### What is the find-replace action?

The find-replace action enables you to perform string substitutions across your local and Dynamic data tables. When you execute a find-replace operation, the system searches for specific string values and replaces them with new values throughout the selected dataset.

### Key Capabilities

**Local Data Updates**: The action works seamlessly with your local and dynamic data tables, allowing you to modify content that resides within your Jigx application environment.

**Bulk Text Operations**: Instead of editing individual records, you can perform sweeping changes across entire datasets. For example, you could replace all instances of "dog-products" with "pet-products" across a products table in a single operation.

**Real-time Synchronization**: Changes made through the find-replace action are immediately reflected in your local tables and can be synchronized with upstream data sources like REST using execute-entities and functions.

### Use Cases

The `find-replace` action is particularly valuable for:

* **Data Standardization**: Correcting inconsistent naming conventions or formatting across large datasets.
* **Content Updates**: Updating company names, product names, or other information that appears multiple times.
* **Data Migration**: Cleaning and transforming data during system transitions.
* **Batch Corrections**: Fixing systematic errors or typos across multiple records.

### Integration with Jigx Ecosystem

This action works as part of Jigx's broader table [operations](https://docs.jigx.com/building-apps-with-jigx/data/data-providers/rest/functions/operations) framework, complementing other data manipulation tools and maintaining consistency with your overall data management workflow.&#x20;

## Configuration options

Some properties are common to all actions, see [Common action properties](/examples/readme/actions/common-action-properties.md) for the list of actions and their configuration options.

<table><thead><tr><th width="152.64453125">Core structure</th><th></th></tr></thead><tbody><tr><td><code>find</code></td><td>The string value to be searched for in the tables.</td></tr><tr><td><code>replace</code></td><td>The string value to replace the found value with in the tables.</td></tr><tr><td><code>tables</code></td><td>The local or dynamic data tables in which the string value is searched for and replaced. </td></tr></tbody></table>

<table><thead><tr><th width="214.0859375">Other options</th><th></th></tr></thead><tbody><tr><td><code>icon</code></td><td>Select an to display when the action is configured as the secondary button or in a <a href="/pages/DRQfvKWYUoQBz1pNkHLL">header action</a>.</td></tr><tr><td><code>includeCommandQueue</code></td><td>If set to <code>false</code>, the command queue will not be included in the find and replace.</td></tr><tr><td><code>isHidden</code></td><td><code>true</code> hides the action button, <code>false</code> shows the action button. Default setting is <code>false</code>.</td></tr><tr><td><code>style</code></td><td><ul><li><code>isDanger</code> - Styles the action button in red or your brand's designated danger color.</li><li><code>isDisabled</code> - Displays the action button as greyed out, preventing the button from being actioned.</li><li><code>isPrimary</code> - Styles the action button in blue or your brand's designated primary color.</li><li><code>isSecondary</code> - Sets the action as a secondary button, accessible via the ellipsis. The <code>icon</code> property can be used when the action button is displayed as a secondary button.</li></ul></td></tr></tbody></table>

## Considerations

* **Use with Caution**: The `find-replace` action requires careful consideration before execution. When you perform a find-replace operation, the data is replaced for every instance found throughout the specified tables. This means that all matching values will be modified simultaneously, which could have unintended consequences if not properly planned. Before executing a find-replace operation, it's recommended to:
  * Carefully review the scope of tables that will be affected
  * Test the operation on a smaller dataset first if possible
  * Verify that the replacement value won't create conflicts or inconsistencies elsewhere in your data

## Examples and code snippets

{% columns %}
{% column width="41.66666666666667%" %}
In this example the region *APAC* is replaced with *EMEA* in the local data table when the action button is tapped.&#x20;
{% endcolumn %}

{% column width="58.33333333333333%" %}

<figure><img src="/files/a0UpU6fTd3p8SxONyzfF" alt="action find and replace"><figcaption><p>Action find and replace</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% tabs %}
{% tab title="action-find-replace" %}

```yaml
title: Customer per Region
type: jig.list

data: =@ctx.datasources.customer
item:
  type: component.list-item
  options:
    title: =@ctx.current.item.name
    subtitle: =@ctx.current.item.contact
    label:
      title: =@ctx.current.item.region
      color: color3

actions:
  - numberOfVisibleActions: 1
    children:
      - type: action.find-replace
        options:
          title: Update region
          find: "APAC"
          replace: "EMEA"
          tables:
            # Local table to replace the found value.
            - customer
            # Dynamic Data table to replace the found value.
            - default/customer
```

{% endtab %}

{% tab title="datasource" %}

```yaml
datasources:
  customer:
    type: datasource.sqlite
    options:
      provider: DATA_PROVIDER_DYNAMIC
      entities:
        - default/customer
      query: SELECT
        id,
        '$.name',
        '$.contact',
        '$.email',
        '$.phone',
        '$.region'
        FROM [default/customer]
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jigx.com/examples/readme/actions/find-replace.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
