Skip to content

Commit 6aab19d

Browse files
authored
Merge pull request #196379 from joshuha-msft/20220420-ADFUDF
20220420 ADF UDF docs updates
2 parents afdc42f + 9d901ff commit 6aab19d

8 files changed

+61
-0
lines changed

articles/data-factory/TOC.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ items:
277277
displayName: cumeDist, denseRank, lag, lead, nTile, rank, rowNumber
278278
- name: Alphabetical usage details for all functions
279279
href: data-flow-expressions-usage.md
280+
- name: User defined functions
281+
href: concepts-data-flow-udf.md
282+
displayName: udf, user defined function,data flow library
280283
- name: Prepare data with Power Query data wrangling
281284
items:
282285
- name: Data wrangling overview

articles/data-factory/concepts-data-flow-expression-builder.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ In mapping data flows, expressions can be composed of column values, parameters,
4848

4949
Mapping data flows has built-in functions and operators that can be used in expressions. For a list of available functions, see the [mapping data flow language reference](data-transformation-functions.md).
5050

51+
### User Defined Functions (Preview)
52+
Mapping data flows supports the creation and use of user defined functions. To see how to create and use user defined functions see [user defined functions](concepts-data-flow-udf.md).
53+
5154
#### Address array indexes
5255

5356
When dealing with columns or functions that return array types, use brackets ([]) to access a specific element. If the index doesn't exist, the expression evaluates into NULL.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: User defined functions in mapping data flows
3+
titleSuffix: Azure Data Factory & Azure Synapse
4+
description: Learn the concepts of user defined functions in mapping data flow
5+
author: joshuha-msft
6+
ms.author: joowen
7+
ms.service: data-factory
8+
ms.subservice: data-flows
9+
ms.custom: synapse
10+
ms.topic: conceptual
11+
ms.date: 04/20/2022
12+
---
13+
14+
# User defined functions in mapping data flow
15+
16+
A user defined function is a customized expression you can define to be able to reuse logic across multiple mapping data flows. User defined functions live in a collection called a data flow library to be able to easily group up common sets of customized functions.
17+
18+
Whenever you find yourself building the same logic in an expression in across multiple mapping data flows this would be a good opportunity to turn that into a user defined function.
19+
20+
## Getting started
21+
22+
To get started with user defined functions, you must first create a data flow library. Navigate to the management page and then find data flow libraries under the author section.
23+
24+
![Screenshot showing the A D F management pane and data flow libraries.](./media/data-flow-udf/data-flow-udf-library.png)
25+
26+
27+
28+
## Data flow library
29+
30+
From here, you can click on +New button to create a new data flow library. Fill out the name and description and then you are ready to create your user defined function.
31+
![Screenshot showing the data flow libraries creation pane.](./media/data-flow-udf/data-flow-udf-library-create.png)
32+
33+
## New user defined function
34+
35+
To create a user defined function, from the data flow library you want to create the function in, click the +New button.
36+
![Screenshot showing the U D F new function button.](./media/data-flow-udf/data-flow-udf-function-new.png)
37+
38+
Fill in the name of your user defined function.
39+
> [!Note]
40+
> You cannot use the name of an existing mapping data flow expression. For a list of the current mapping data flow expressions, see [Data transformation expressions in mapping data flow | Microsoft Docs](data-transformation-functions.md)
41+
42+
![Screenshot showing the U D F new function creation pane.](./media/data-flow-udf/data-flow-udf-function-pane.png)
43+
44+
User defined functions can have zero or more arguments. Arguments allow you to pass in values when your function is called and refer to those arguments in your expression logic. Arguments are automatically named from i1, i2, etc. and you can choose the data type of the argument from the dropdown.
45+
46+
The body of the user defined function is where you specify the logic of your function. The editor provides the full [expression builder | Microsoft Docs](concepts-data-flow-expression-builder.md) experience and allows you to reference your arguments created and any [data transformation expressions in mapping data flow | Microsoft Docs](data-transformation-functions.md).
47+
48+
> [!Note]
49+
> A user defined function cannot refer to another user defined function.
50+
51+
## Using a user defined function in the expression builder
52+
53+
User defined functions will appear in the mapping data flow expression builder under Data flow library functions. From here, you can use your custom created functions and pass in appropriate arguments (if any) that you've defined.
54+
55+
![Screenshot showing the data flow library in the mapping data flow expression builder.](./media/data-flow-udf/data-flow-udf-expression-builder.png)
177 KB
Loading
42.3 KB
Loading
36.4 KB
Loading
112 KB
Loading
166 KB
Loading

0 commit comments

Comments
 (0)