---
title: "Automation Numerical Value Format Conversion"
slug: "working-with-different-currencies"
updated: 2024-04-12T06:55:09Z
published: 2024-04-12T06:55:09Z
canonical: "success.panaya.com/working-with-different-currencies"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://success.panaya.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Converting Numerical Values in Automated Tests

When working with different currencies and data sets, it is recommended that you use the [Execute code command](/v1/docs/how-to-use-the-execute-code-command) with JavaScript to format the values according to your needs.

Here is an example of working with European currency. In most European countries, a comma is used as the decimal separator, for example, 679,00 EUR, whereas a decimal point (period) is used in other countries.

Panaya [Data Sets](/v1/docs/automation-input-parameters-data-sets) work with integer parameters for numerical values. Below is the default format used -

###,###.###

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-TDBC1JZT.png)

To convert a supported data set [input parameter](/v1/docs/automation-input-parameters-data-sets) from 679.00 to 679,00 follow the instructions in this article.

## Converting the Format

1. To convert, use an [Execute code](/v1/docs/execute-code) command -

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-HP3HDLEZ.png)

1. In the script, create a new input parameter - dataprice.

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-GQXFA4U4.png)

Then, set an [internal parameter](/v1/docs/automation-parameters) to a string value. We will later assign the formatted data price from the Data Set input parameter to this internal parameter.

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-9XKFFH9P.png)

3. In the Execute code screen, add the below JavaScript to format the price -

```javascript
let num = panayaVars.dataprice; //assign the dataprice value to a variable num
var mystring = num.toString();  //convert the data set number value to a string
mystring = mystring.replace(/[,.]/g, function (m) {// If , is matched, return ., if . is matched, return , 
return m === ',' ? '.' : ','; }); (use JavaScript to format the string, and replace the "." with a "," where required)
panayaVars.price = mystring;  //update the price parameter back with the formatted price
```

1. Set the Execute code command with the JavaScript in step 3 like shown below.

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-4I0ECA7T.png)

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-VSRBPK8T.png)
2. Set the [validate screen element](/v1/docs/script-builder-commands) command as the last instruction.

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-81P549BS.png)

![](https://cdn.document360.io/f404076c-de23-4609-848e-2dfd4ef701b0/Images/Documentation/image-GA5Z87N0.png)
