# Transaction

## Description:

Transaction

Similar to JDBC Transaction, this component can be used to group multiple datastores into a single transaction. When you post the changes using `Save Transaction` action, all the changes across all the datastores inside this transaction will be posted in a single request. If one datasource fails, then all changes within this transaction will be rolled back.

As a best practice always use Transaction when developing data entry applications. With transaction, you can define the parent-child relationship between datasources using the `Mapping`.**Querying Child Stores**

When `Auto Query Child Stores` is checked, all the child datasources will be automatically queried when the user navigates between the parent store records. The child stores will be filtered using the parent attribute values of the defined Mapping.**Defaulting of Child Attributes**

Let's take a simple example of `Dept` (Dept ID, Dept Name) & `Emp` (Emp ID, Emp Name & Emp Dept ID) datasources as parent child Transactions with a Mapping `Dept ID` - `Emp Dept ID`. Let's assume the Dept ID & Emp ID are auto generated on the server only after saving the transaction. When you create a new department and emp at the same time and save the transaction, the platform will first create the department which would generate a Dept ID for the newly created department and then copy the `Dept ID` from the `Dept` datasource record into `Emp Dept ID` attribute of `Emp` datasource record before saving the `Emp` datasource.

### Allowed Parent Components:

1. Page
2. Transaction

### Allowed Child Components:

1. Mapping
2. Transaction
3. Trigger After Save
4. Trigger Before Save

### Properties

### ➤ Data Source Alias

Select the DataSource Alias name to perform actions on the store behind this DataSource Alias.

Allowed Values: Select the DataSource Alias name to perform actions on the store behind this DataSource Alias.

### ➤ Transaction Code

Provide a unique code to group datasources for DML operations.

Allowed Values: Free text field

### ➤ Auto Query Child Stores

Check this to query all the child datasources when the user navigates between the parent store records. The child stores will be filtered using the parent attribute values of the defined Mapping.

Allowed Values: Yes/No

### ➤ Hide No Changes Info

Enable this property to Hide the message(no changes to Save) whenever we click on save button without making any changes.

Allowed Values: Yes/No

### ➤ Allow Duplicate

Check this property to create transaction mapping for already used data source alias.

Allowed Values: Yes/No

### ➤ Cache Child Records

Enable this property to fetch the child records from cache otherwise it gets from the datastore.

Allowed Values: Yes/No


---

# 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.cloudio.io/ui-components/widgets/transaction.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.
