Skip to content

Commit 4aae1af

Browse files
committed
Update EntityName to optional parameter
1 parent 600d70b commit 4aae1af

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

utility/getDataflowEntity.pq

+15-24
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
let
2-
Function =
3-
(WorkspaceId as text, DataflowId as text, EntityName as text) as table =>
4-
let
5-
//DEBUGGING VARIABLES
6-
//WorkspaceId = WorkspaceId_DataDictionary,
7-
//DataflowId = DataflowId_DataDictionary,
8-
//EntityName = "column_rename",
9-
10-
SrcData = PowerBI.Dataflows(),
11-
WorkspaceData = SrcData{[workspaceId = WorkspaceId]}[Data],
12-
DataflowData = WorkspaceData{[dataflowId = DataflowId]}[Data],
13-
DataflowEntity = DataflowData{[entity = EntityName]}[Data]
14-
in
15-
DataflowEntity,
16-
FunctionType =
17-
type function (WorkspaceId as text, DataflowId as text, EntityName as text) as table
2+
getDataflowEntity =
3+
(WorkspaceId as text, DataflowId as text, optional EntityName as text) =>
4+
let
5+
Source = PowerBI.Dataflows(null),
6+
Workspace = Source{[workspaceId=WorkspaceId]}[Data],
7+
Dataflow = Workspace{[dataflowId=DataflowId]}[Data],
8+
Entity = if EntityName = null then Dataflow else Dataflow{[entity=EntityName]}[Data]
9+
in
10+
Entity,
11+
Documentation = type function (WorkspaceId as text, DataflowId as text, optional EntityName as text) as table
1812
meta
1913
[
2014
Documentation.Author = "Miquel Despuig",
21-
Documentation.Version = "0.0.0", // MajorVersion|MinorVersion|Revision
15+
Documentation.Version = "0.1.0", // MajorVersion|MinorVersion|Revision
16+
Documentation.Date = "2022-05-03",
2217
Documentation.Name = "getDataflowEntity",
23-
Documentation.LongDescription = "Returns a table with the data in the <code>EntityName</code> from the Workspace <code>WorkspaceId</code> and Dataflow <code>DataflowId</code>"
18+
Documentation.Description = "Given a <code>WorkspaceId</code> and a <code>DataflowId</code> and an optional <code>EntityName</code> returns either a table with a list of entities in the specified dataflow or a table with the data in the <code>EntityName</code>"
2419
],
25-
Ascribed =
26-
Value.ReplaceType(
27-
Function,
28-
FunctionType
29-
)
20+
Ascribed = Value.ReplaceType(getDataflowEntity, Documentation)
3021
in
31-
Ascribed
22+
Ascribed

0 commit comments

Comments
 (0)