# Creating Functions

Create reusable transformation functions for your jobs.

> **Important:** Save the job before creating functions.

## Step 1: Select a Job

* Identify the relevant job from the list.
* Click on Select for the specific job.

![Select Job](/files/dzMl4vhEM2W0ShQFpcuX)

## Step 2: Fetch Data

* Click **Fetch Data** to retrieve records from the selected source.
* Fetched data displays in a table for analysis.

![Fetch Data](/files/8FCdkOfuPRqshvemMed7)

## Step 3: View Fetched Data

* Review the data in tabular format.
* Use **Add Row** or **Clear Data** options as needed.

![View Fetched Data](/files/0YqvAizEIFBZXx9XW2Eb)

## Step 4: Generate a Function

* Enter the prompt to generate transformation function in the text editor.
* Choose **Single Column** or **Multiple Columns** mode.
* Provide a **Function Name**.
* Click **Generate** to create the function.

### Example: Single Column Function

Convert date format (`yyyy/mm/dd` → `dd/mm/yyyy`):

1. Select **Single Column** mode.
2. Choose the column (`transactiondate`).
3. Enter function name (e.g., `Date Conversion`).
4. Click **Generate**, then **Run**.
5. Review the transformed data in the table.
6. Verify the changes are correct.
7. Edit and re-run if corrections are needed.
8. Click **Save** to store the function.

![Single Column Function](/files/gBLzlW3NUJvjBLpkQZIj)

![Single Column Function](/files/6bfnLtUpdXxvnflsmf13)

### Example: Multiple Columns Function

Convert currency from rupees to dollars.

1. Select **Multiple Columns** mode.
2. Define transformation logic:
   * Convert transactionamount and accountbalance from INR to USD where currencycode = 'INR', round the converted amounts to 2 decimal places, and update currencycode to USD.
3. Enter function name (e.g., `Currency Conversion`).
4. Click **Generate**, then **Run**.
5. Review the transformed data.
6. Verify the changes are correct.
7. Edit and re-run if corrections are needed.
8. Click **Save** to store the function.

![Multiple Columns Function](/files/kQgRocumm1TxEHfBlBGK)

![Multiple Columns Function](/files/7HcHw2FDEKHz2rajeDJd)

## Step 5: View Saved Functions

* Navigate to **Saved Functions** from the left menu.
* View all created functions with details:
  * Function Name.
  * Function Type (Single or Multiple Columns).
  * Created By.
  * Created At.

![Saved Functions](/files/Vb7EEqe8xyH5JrtQpLOA)


---

# 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.qyrus.com/data-testing/functions-and-transformations/index/creating-functions.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.
