Forum Discussion
Custom Connector and Navigation Tables
- 6 years ago
What you need to do is use Table.View, it is very powerful as it lets you reinterpate any code that transforms or drills into a table. In paticular you want to include a defination for the handler OnSelectRows:
View= (state) =>
Table.View(null,
[
GetType = () => ...,
GetRows = () => ...,
OnSelectRows = (selector) =>
let
condition = RowExpression.From(selector),...,
in
@View(newState)
])
The selector will be the abstract syntax tree of the query. If the code returns an error, then the view is handled by default logic and the next higher view in the stack will be tried.
Just add a parameter to the top level function to track it.
artemus which one? Could you said concrete place?
Thanks
- artemus6 years agoMicrosoft Employee
For example, you can add it like:
NavigationTableFromList = (category as text, dataFunction as function, listFunction as function, optional isLeaf as logical) as table =>Then when you cann NavigationTableFromList, just pass in the category.
- Anonymous6 years agoNot applicable
artemus How to pass state from OnSelectRow? I get always state=null.
- Anonymous6 years agoNot applicable
OnSelectRows = (selector) => let condition = RowExpression.From(selector), kind = condition[Kind], leftKind = condition[Left][Kind], member = condition[Left][MemberName], value = condition[Right][Value] in if (kind = "Binary" and leftKind = "FieldAccess" and member = "Name") then Table.FromRecords({[ Name = value, Data = dataFunction(value), ItemKind = "Table" ItemName = value, IsLeaf = true ]})
Table.SelectRows(#"PeoplesTable", each ([PersonId] = "188997-d485-47d4-b721-515194303fa3" or [PersonId] = "565950f29-ab8a-4b6e-ad0f-de67d0bf32
6b5") and ([FirstName] = "John))artemus if there is more then one value, how to parse them? For example above sample, how to understand what were filtered?
- artemus6 years agoMicrosoft Employee
Make a simple query in power bi Desktop with (no need to have any data loaded):
RowExpression.From( each ([PersonId] = "188997-d485-47d4-b721-515194303fa3" or [PersonId] = "565950f29-ab8a-4b6e-ad0f-de67d0bf32
6b5") and ([FirstName] = "John"))Then drilldown to find what the strucutre is. and detect that pattern in your code.