Forum Discussion
Query iteration
- 8 years ago
After a week of work and with the help from the guys from TechNet! My query has succesfully ran!
All I had to do is create a custom function that takes in a value id as a number and interpolates it:
(id as number) => let Source = Json.Document(Web.Contents("https://api.icims.com/customers/0000/people/"&Text.From(Id)&"", [Headers=[Accept="Basic fakecredentials"]])) in SourceAnother query calling that function(The text highligthed with red is the important stuff):
let Source = Json.Document(Web.Contents("https://api.icims.com/customers/0000/search/people?searchJson={ ""filters"": [ { ""name"": ""person.firstname"", ""value"": [""""], ""operator"": ""!="" } ] }", [Headers=[Accept="Basic faketoken"]])), #"Converted to Table" = Record.ToTable(Source), #"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"), #"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"id"}, {"Value.id"}), #"Filtered Rows" = Table.SelectRows(#"Expanded Value1", each true), #"Value id1" = #"Filtered Rows"[Value.id], ToTable = Table.FromList(#"Value id1", Splitter.SplitByNothing(), null, null, ExtraValues.Error), Renamed = Table.RenameColumns(ToTable,{{"Column1", "ID"}}), Added = Table.AddColumn(Renamed, "Custom", each GetRecords([ID])) in AddedThis second query has a column with IDs. The red text.. gets the results of the function I created GetRecords(ID) and returns all of the records.
Here's the link to the TechNet thread: https://social.technet.microsoft.com/Forums/en-US/ef3d163d-aced-4a13-8183-5d529cc5a678/how-can-i-loop-through-an-array-and-interpolate-the-number?forum=powerquery
Thanks everybody! I hope someone finds this useful!
Hi surfersamu,
Welcome to share your workaround, and mark it as answer, so more people will benefit from here.
Best Regards,
Angelia
After a week of work and with the help from the guys from TechNet! My query has succesfully ran!
All I had to do is create a custom function that takes in a value id as a number and interpolates it:
(id as number) =>
let
Source = Json.Document(Web.Contents("https://api.icims.com/customers/0000/people/"&Text.From(Id)&"", [Headers=[Accept="Basic fakecredentials"]]))
in
SourceAnother query calling that function(The text highligthed with red is the important stuff):
let
Source = Json.Document(Web.Contents("https://api.icims.com/customers/0000/search/people?searchJson={ ""filters"": [ { ""name"": ""person.firstname"", ""value"": [""""], ""operator"": ""!="" } ] }", [Headers=[Accept="Basic faketoken"]])),
#"Converted to Table" = Record.ToTable(Source),
#"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
#"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"id"}, {"Value.id"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Value1", each true),
#"Value id1" = #"Filtered Rows"[Value.id],
ToTable = Table.FromList(#"Value id1", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Renamed = Table.RenameColumns(ToTable,{{"Column1", "ID"}}),
Added = Table.AddColumn(Renamed, "Custom", each GetRecords([ID]))
in
AddedThis second query has a column with IDs. The red text.. gets the results of the function I created GetRecords(ID) and returns all of the records.
Here's the link to the TechNet thread: https://social.technet.microsoft.com/Forums/en-US/ef3d163d-aced-4a13-8183-5d529cc5a678/how-can-i-loop-through-an-array-and-interpolate-the-number?forum=powerquery
Thanks everybody! I hope someone finds this useful!
- Anonymous8 years agoNot applicable
Hi surfersamu,
I gat a question. What exactly this line in the code exactly doing?
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each true)
A similar line is showing in my Advance query editor, which I have no clue about.
Thanks