Skip to content

Commit 35f3833

Browse files
authored
Merge pull request #189980 from AbodeSaafan/DecimalDocs
Adding documentation for the decimal function
2 parents 520ab17 + 3d5f905 commit 35f3833

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

articles/logic-apps/workflow-definition-language-functions-reference.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: logic-apps
55
ms.suite: integration
66
ms.reviewer: estfan, niding, azla
77
ms.topic: reference
8-
ms.date: 02/18/2022
8+
ms.date: 03/01/2022
99
---
1010

1111
# Reference guide to workflow expression functions in Azure Logic Apps and Power Automate
@@ -178,6 +178,7 @@ To change a value's type or format, you can use these conversion functions. For
178178
| [dataUri](../logic-apps/workflow-definition-language-functions-reference.md#dataUri) | Return the data URI for an input value. |
179179
| [dataUriToBinary](../logic-apps/workflow-definition-language-functions-reference.md#dataUriToBinary) | Return the binary version for a data URI. |
180180
| [dataUriToString](../logic-apps/workflow-definition-language-functions-reference.md#dataUriToString) | Return the string version for a data URI. |
181+
| [decimal](../logic-apps/workflow-definition-language-functions-reference.md#decimal) | Return the decimal number for a decimal string. |
181182
| [decodeBase64](../logic-apps/workflow-definition-language-functions-reference.md#decodeBase64) | Return the string version for a base64-encoded string. |
182183
| [decodeDataUri](../logic-apps/workflow-definition-language-functions-reference.md#decodeDataUri) | Return the binary version for a data URI. |
183184
| [decodeUriComponent](../logic-apps/workflow-definition-language-functions-reference.md#decodeUriComponent) | Return a string that replaces escape characters with decoded versions. |
@@ -1685,6 +1686,61 @@ dayOfYear('2018-03-15T13:27:36Z')
16851686

16861687
And returns this result: `74`
16871688

1689+
<a name="decimal"></a>
1690+
1691+
### decimal
1692+
1693+
Returns a decimal number in a string as a decimal number. You can use this function when you're working with data that requires decimal precision and also as input for [logical comparison functions](#logical-comparison-functions) and [math functions](#math-functions). To capture and preserve precision when you use the result from the **decimal()** function, wrap any decimal output with the [string function](#string). This usage is shown in the following examples below where you can lose precision if you use the decimal result as a number.
1694+
1695+
> [!NOTE]
1696+
> The decimal precision that's discussed in the context for this function and the Azure Logic Apps runtime is the same as the [.NET decimal precision](/dotnet/api/system.decimal?view=netframework-4.7.1&preserve-view=true).
1697+
1698+
```
1699+
decimal('<value>')
1700+
```
1701+
1702+
| Parameter | Required | Type | Description |
1703+
| --------- | -------- | ---- | ----------- |
1704+
| <*value*> | Yes | String | The decimal number in a string |
1705+
|||||
1706+
1707+
| Return value | Type | Description |
1708+
| ------------ | ---- | ----------- |
1709+
| <*decimal*> | Decimal Number | The decimal number for the input string |
1710+
||||
1711+
1712+
*Example 1*
1713+
1714+
This example creates a decimal that's used as a number:
1715+
1716+
```
1717+
decimal('1.2345678912312131') // Returns 1.234567891231213.
1718+
```
1719+
1720+
*Example 2*
1721+
1722+
This example creates a decimal and then converts the result to a string for precision preservation:
1723+
1724+
```
1725+
string(decimal('1.2345678912312131')) // Returns "1.2345678912312131".
1726+
```
1727+
1728+
*Example 3*
1729+
1730+
This example uses a math function on two decimal numbers and uses the result as a number:
1731+
1732+
```
1733+
add(decimal('1.2345678912312131'), decimal('1.2345678912312131')) // Returns 2.469135782462426.
1734+
```
1735+
1736+
*Example 4*
1737+
1738+
This example uses a math function on two decimal numbers and converts the result to a string for precision preservation:
1739+
1740+
```
1741+
string(add(decimal('1.2345678912312131'), decimal('1.2345678912312131'))) // Returns "2.4691357824624262".
1742+
```
1743+
16881744
<a name="decodeBase64"></a>
16891745

16901746
### decodeBase64 (deprecated)

0 commit comments

Comments
 (0)