Skip to content

Commit 9e2632c

Browse files
committed
Add info about implicit data conversion
1 parent d174c57 commit 9e2632c

File tree

1 file changed

+56
-45
lines changed

1 file changed

+56
-45
lines changed

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

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@ title: Reference guide for functions in expressions
33
description: Reference guide to functions in expressions for Azure Logic Apps and Power Automate
44
services: logic-apps
55
ms.suite: integration
6-
ms.reviewer: klam, logicappspm
6+
ms.reviewer: jonfan, logicappspm
77
ms.topic: conceptual
8-
ms.date: 02/03/2020
8+
ms.date: 04/17/2020
99
---
1010

1111
# Reference guide to using functions in expressions for Azure Logic Apps and Power Automate
1212

13-
For workflow definitions in [Azure Logic Apps](../logic-apps/logic-apps-overview.md)
14-
and [Power Automate](https://docs.microsoft.com/flow/getting-started), some
15-
[expressions](../logic-apps/logic-apps-workflow-definition-language.md#expressions)
16-
get their values from runtime actions that might not yet exist when your
17-
workflow starts running. To reference these values or process the values
18-
in these expressions, you can use *functions* provided by the
19-
[Workflow Definition Language](../logic-apps/logic-apps-workflow-definition-language.md).
13+
For workflow definitions in [Azure Logic Apps](../logic-apps/logic-apps-overview.md) and [Power Automate](https://docs.microsoft.com/flow/getting-started), some [expressions](../logic-apps/logic-apps-workflow-definition-language.md#expressions) get their values from runtime actions that might not yet exist when your workflow starts running. To reference these values or process the values in these expressions, you can use *functions* provided by the [Workflow Definition Language](../logic-apps/logic-apps-workflow-definition-language.md).
2014

2115
> [!NOTE]
2216
> This reference page applies to both Azure Logic Apps and Power Automate,
@@ -25,33 +19,23 @@ in these expressions, you can use *functions* provided by the
2519
> For more information about functions and expressions in Power Automate, see
2620
> [Use expressions in conditions](https://docs.microsoft.com/flow/use-expressions-in-conditions).
2721
28-
For example, you can calculate values by using math functions, such as the
29-
[add() function](../logic-apps/workflow-definition-language-functions-reference.md#add),
30-
when you want the sum from integers or floats. Here are other
31-
example tasks that you can perform with functions:
22+
For example, you can calculate values by using math functions, such as the [add()](../logic-apps/workflow-definition-language-functions-reference.md#add) function, when you want the sum from integers or floats. Here are other example tasks that you can perform with functions:
3223

3324
| Task | Function syntax | Result |
3425
| ---- | --------------- | ------ |
3526
| Return a string in lowercase format. | toLower('<*text*>') <p>For example: toLower('Hello') | "hello" |
3627
| Return a globally unique identifier (GUID). | guid() |"c2ecc88d-88c8-4096-912c-d6f2e2b138ce" |
3728
||||
3829

39-
To find functions [based on their general purpose](#ordered-by-purpose),
40-
review the following tables. Or, for detailed information about each function,
41-
see the [alphabetical list](#alphabetical-list).
30+
To find functions [based on their general purpose](#ordered-by-purpose), review the following tables. Or, for detailed information about each function, see the [alphabetical list](#alphabetical-list).
4231

4332
> [!NOTE]
44-
> In the syntax for parameter definitions, a question mark (?)
45-
> that appears after a parameter means the parameter is optional.
46-
> For example, see [getFutureTime()](#getFutureTime).
33+
> In the syntax for parameter definitions, a question mark (?) that appears after a parameter
34+
> means the parameter is optional. For example, see [getFutureTime()](#getFutureTime).
4735
4836
## Functions in expressions
4937

50-
To show how to use a function in an expression,
51-
this example shows how you can get the value from
52-
the `customerName` parameter and assign that value
53-
to the `accountName` property by using the
54-
[parameters()](#parameters) function in an expression:
38+
To show how to use a function in an expression, this example shows how you can get the value from the `customerName` parameter and assign that value to the `accountName` property by using the [parameters()](#parameters) function in an expression:
5539

5640
```json
5741
"accountName": "@parameters('customerName')"
@@ -76,10 +60,8 @@ so that you get a combined string, "SophiaOwen":
7660
"customerName": "@concat('Sophia', 'Owen')"
7761
```
7862

79-
Or, you can get string values from parameters. This example
80-
uses the `parameters()` function in each `concat()` parameter
81-
and the `firstName` and `lastName` parameters. You then pass
82-
the resulting strings to the `concat()` function so that
63+
Or, you can get string values from parameters. This example uses the `parameters()` function in each `concat()` parameter
64+
and the `firstName` and `lastName` parameters. You then pass the resulting strings to the `concat()` function so that
8365
you get a combined string, for example, "SophiaOwen":
8466

8567
```json
@@ -88,17 +70,14 @@ you get a combined string, for example, "SophiaOwen":
8870

8971
Either way, both examples assign the result to the `customerName` property.
9072

91-
Here are the available functions ordered by their general purpose,
92-
or you can browse the functions based on [alphabetical order](#alphabetical-list).
73+
Here are the available functions ordered by their general purpose, or you can browse the functions based on [alphabetical order](#alphabetical-list).
9374

9475
<a name="ordered-by-purpose"></a>
9576
<a name="string-functions"></a>
9677

9778
## String functions
9879

99-
To work with strings, you can use these string functions
100-
and also some [collection functions](#collection-functions).
101-
String functions work only on strings.
80+
To work with strings, you can use these string functions and also some [collection functions](#collection-functions). String functions work only on strings.
10281

10382
| String function | Task |
10483
| --------------- | ---- |
@@ -121,8 +100,7 @@ String functions work only on strings.
121100

122101
## Collection functions
123102

124-
To work with collections, generally arrays, strings,
125-
and sometimes, dictionaries, you can use these collection functions.
103+
To work with collections, generally arrays, strings, and sometimes, dictionaries, you can use these collection functions.
126104

127105
| Collection function | Task |
128106
| ------------------- | ---- |
@@ -143,10 +121,7 @@ and sometimes, dictionaries, you can use these collection functions.
143121

144122
## Logical comparison functions
145123

146-
To work with conditions, compare values and expression results,
147-
or evaluate various kinds of logic, you can use these logical comparison functions.
148-
For the full reference about each function, see the
149-
[alphabetical list](../logic-apps/workflow-definition-language-functions-reference.md#alphabetical-list).
124+
To work with conditions, compare values and expression results, or evaluate various kinds of logic, you can use these logical comparison functions. For the full reference about each function, see the [alphabetical list](../logic-apps/workflow-definition-language-functions-reference.md#alphabetical-list).
150125

151126
| Logical comparison function | Task |
152127
| --------------------------- | ---- |
@@ -165,12 +140,14 @@ For the full reference about each function, see the
165140

166141
## Conversion functions
167142

168-
To change a value's type or format, you can use these conversion functions.
169-
For example, you can change a value from a Boolean to an integer.
170-
For more information about how Logic Apps handles content types during
171-
conversion, see [Handle content types](../logic-apps/logic-apps-content-type.md).
172-
For the full reference about each function, see the
173-
[alphabetical list](../logic-apps/workflow-definition-language-functions-reference.md#alphabetical-list).
143+
To change a value's type or format, you can use these conversion functions. For example, you can change a value from a Boolean to an integer. For more information about how Logic Apps handles content types during conversion, see [Handle content types](../logic-apps/logic-apps-content-type.md). For the full reference about each function, see the [alphabetical list](../logic-apps/workflow-definition-language-functions-reference.md#alphabetical-list).
144+
145+
> [!IMPORTANT]
146+
> The Logic Apps service automatically or implicitly converts values between specific data types,
147+
> which means that you don't have to manually or explicitly convert those values by using the
148+
> corresponding functions. If you use these functions in the designer or code view, Logic Apps
149+
> removes those functions after you save your logic app because the conversion happens automatically.
150+
> For more information, see [Implicit data type conversions](#implicit-data-conversions).
174151
175152
| Conversion function | Task |
176153
| ------------------- | ---- |
@@ -198,6 +175,40 @@ For the full reference about each function, see the
198175
| [xml](../logic-apps/workflow-definition-language-functions-reference.md#xml) | Return the XML version for a string. |
199176
|||
200177

178+
<a name="implicit-data-conversions"></a>
179+
180+
## Implicit data type conversions
181+
182+
The Logic Apps service automatically or implicitly converts values between specific data types, which means that you don't have to manually or explicitly convert those values by using the corresponding functions. If you use these functions in the designer or code view, Logic Apps removes those functions after you save your logic app because the conversion happens automatically.
183+
184+
This table describes the conversions that Logic Apps implicitly makes:
185+
186+
| Data conversion <br>(To > From) | Byte | Binary or File | DataUri | Other |
187+
|---------------------------------|------|----------------|---------|-------|
188+
| **Byte** | Not applicable | `base64(<value>)` | `base64(decodeDataUri(<value>))` | `base64(<value>)` |
189+
| **Binary or File** | `base64ToBinary(<value>)` | Not applicable | `decodeDataUri(<value>)` | Not applicable |
190+
| **DataUri** | `concat('data:;base64,', <value>)` | `concat('data:;base64,', base64(<value>))` | Not applicable | `concat('data:,', encodeUriComponent(<value>))` |
191+
| **Other** | `base64ToString(<value>)` | Not applicable | `decodeDataUri(<value>)` | `Not applicable` |
192+
||||||
193+
194+
Logic Apps also implicitly converts non-string values into strings when these values are used where strings are expected. For example:
195+
196+
* A trigger returns a numerical value as output through this expression:
197+
198+
`triggerBody()?['number']`
199+
200+
If the numerical value is used for a string input, such as an HTTP URL, you get this expression:
201+
202+
`@{triggerBody()?['number']}`
203+
204+
* A trigger returns a string value as output through this expression:
205+
206+
`triggerBody()?['string']`
207+
208+
If the string value is used for a string input, you get this expression:
209+
210+
`@triggerBody()?['string']`
211+
201212
<a name="math-functions"></a>
202213

203214
## Math functions

0 commit comments

Comments
 (0)