Forum Discussion
Dataflow Gen2 - Getting source name
- 1 year ago
Hi tcollett0
To achieve this, define a variable to store the source name string before navigation steps, and then add it as a custom column after loading the target table. Adjust existing code as follows:
let
Source = Dynamics365BusinessCentral.ApiContentsWithOptions("CityWide-UAT", null, null, [UseReadOnlyReplica = true, AcceptLanguage = null, Timeout = null, ODataMaxPageSize = null]),
SourceName = "Central Kentucky",
Navigation1 = try Source{[Name = SourceName]}[Data] otherwise error "Source '" & SourceName & "' not found",
Navigation2 = try Navigation1{[Name = "WebServices"]}[Data] otherwise error "WebServices not found",
Navigation3 = try Navigation2{[Name = "CW_G_L_Entries", Signature = "table"]}[Data] otherwise error "CW_G_L_Entries not found",
AddSourceColumn = Table.AddColumn(Navigation3, "Source_Location", each SourceName, type text)
in
AddSourceColumn
This ensures that each row in your final result will carry the correct source name without hardcoding it multiple times.
If this post helps, kindly mark it Accepted Solution. It will helps others to find more easily.
Thank You!
Here is the code:
- v-karpurapud1 year agoCommunity Support
Hi tcollett0
To achieve this, define a variable to store the source name string before navigation steps, and then add it as a custom column after loading the target table. Adjust existing code as follows:
let
Source = Dynamics365BusinessCentral.ApiContentsWithOptions("CityWide-UAT", null, null, [UseReadOnlyReplica = true, AcceptLanguage = null, Timeout = null, ODataMaxPageSize = null]),
SourceName = "Central Kentucky",
Navigation1 = try Source{[Name = SourceName]}[Data] otherwise error "Source '" & SourceName & "' not found",
Navigation2 = try Navigation1{[Name = "WebServices"]}[Data] otherwise error "WebServices not found",
Navigation3 = try Navigation2{[Name = "CW_G_L_Entries", Signature = "table"]}[Data] otherwise error "CW_G_L_Entries not found",
AddSourceColumn = Table.AddColumn(Navigation3, "Source_Location", each SourceName, type text)
in
AddSourceColumn
This ensures that each row in your final result will carry the correct source name without hardcoding it multiple times.
If this post helps, kindly mark it Accepted Solution. It will helps others to find more easily.
Thank You!- v-karpurapud1 year agoCommunity Support
Hi tcollett0
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.