Forum Discussion
JackSoderstrom
4 years agoHelper I
Use a field name as a parameter
I want to have a dynamic function that uses many names as a field name. GetRowData = (table, RowIter, ColumnName) =>
let
end = table{RowIter}[ColumnName] //This line searches for "C...
- Anonymous4 years ago
This works:
(tableName as table, RowIter as number, columnName as text) =>
let
end = Record.Field(tableName{RowIter}, columnName)
in
end
"table' is a protected word, so you can't use that as a parameter name. Anyway, this will result in the single value of whatever is in that field (as opposed to returning a record or a table or a list value).
--Nate
Anonymous
4 years agoNot applicable
This works:
(tableName as table, RowIter as number, columnName as text) =>
let
end = Record.Field(tableName{RowIter}, columnName)
in
end
"table' is a protected word, so you can't use that as a parameter name. Anyway, this will result in the single value of whatever is in that field (as opposed to returning a record or a table or a list value).
--Nate