Forum Discussion
Record.Field(_, projNo) as parameter for a JSON Document Web Contents
- Anonymous2 years ago
Thank you latimeria, I figured out my issue. I was calling my function incorrectly!
Instead, I needed to Invoke Custom Function (Add Column tab) to call the function.
This is my solution:
= Table.AddColumn(Source, "getProjectURI", each getProjectURI([projNo], "rooms", #"101mapRooms"))I had tried to simplify the function but eliminated a key component as you noted:
#"FilterColumnTable"
(ProjectNo as text, tblColumn as table)=>
let
// #"FilterColumnTable" = Table.SelectRows(tblColumn, each Record.Field(_,ProjectNo)),
#"FilterColumnTable" = Table.SelectRows(tblColumn, (r) => Record.Field(r,ProjectNo)),
DatabaseName = "abc",
ObjectType = "rooms",
Proj =
Json.Document(
Web.Contents(
"https://api-us.drofus.com/api/",
[
RelativePath= DatabaseName & "/" & ProjectNo & "/" & ObjectType & "?$select=room_function_0_no,room_function_0_name,room_function_1_no,room_function_1_name,room_func_no,name,description,architect_no,programmed_area,designed_area,rds_status"
]
)
)
in
Proj
Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?
Am I missing the 'each'
Hi Anonymous ,
Sorry, I misunderstood the issue.
Call the function like this: getProjectURI([projNo], Source)
My understanding is that the step #"FilterColumnTable" is useless
#"FilterColumnTable" = Table.SelectRows(tblColumn, (r) => Record.Field(r,ProjectNo)),
you select no row (no condition).
FYI , each is a shortcut for the function (_)=> .
If it doesn't work, can you provide an example of the whole step when calling the function.