none
Table.View() RRS feed

Answers

  • For the time being, this is an implementation detail of certain other things -- so it's not especially interesting in its current form. The intent is to effectively be able to define a virtual table, but there are a lot of pieces missing before you can really do anything useful with it.

    Here's an example of a table definition whose exact type and rows are both calculated lazily. This is interesting only insofar as it's the only mechanism for lazily defining a table's type from within M. The ability to do that is not something that most people would care about :).

    Table.View(null, [GetRows = () => #table({"one"}, {}), GetType = () => type table [text]])

    Edit: Why aren't you asking about RowExpression.From? :P

    Tuesday, January 12, 2016 5:37 PM

All replies

  • For the time being, this is an implementation detail of certain other things -- so it's not especially interesting in its current form. The intent is to effectively be able to define a virtual table, but there are a lot of pieces missing before you can really do anything useful with it.

    Here's an example of a table definition whose exact type and rows are both calculated lazily. This is interesting only insofar as it's the only mechanism for lazily defining a table's type from within M. The ability to do that is not something that most people would care about :).

    Table.View(null, [GetRows = () => #table({"one"}, {}), GetType = () => type table [text]])

    Edit: Why aren't you asking about RowExpression.From? :P

    Tuesday, January 12, 2016 5:37 PM
  • Hi Chris,

    Have a look at this M definition of Table.View used by Table Module inside Power BI Desktop.

    Module.Table.m

    I'm still trying to make sense of it :)
    Tuesday, March 28, 2017 12:56 PM
  • I know a bit more about it now - enough to know it's not something we can do anything useful with right now ;-)

    Chris


    Check out my MS BI blog I also do SSAS, PowerPivot, MDX and DAX consultancy and run public SQL Server and BI training courses in the UK

    Tuesday, March 28, 2017 9:11 PM
  • Hey Curt,

    So, what's so special about RowExpression.From . You got us all intrigued ?  : )

    Thanks, Nick

    Tuesday, March 6, 2018 2:56 PM
  • I'm preparing a blog post on this family of functions. A sort of PoC on decompiling PowerQuery functions via Value.ResourceExpression 

    But eager to hear from Curt on any interesting bits he could share on RowExpression.From

    Tuesday, March 6, 2018 7:40 PM
  • "I suppose I deserve this for being a smartass in the other question, but its answer is pretty much the same: "For the time being, this is an implementation detail of certain other things." However, you can imagine based on the description of this function in the help text that this could be useful if you were trying to build a virtual table that was able to intercept user filters and fold them to an underlying source." - Curt Hagenlocher
    Tuesday, March 6, 2018 7:58 PM
  • Both Table.View and RowExpression.From are important for implementing folding in custom data connectors. I know that Matt had been working on an example showing how to implement OData using these, but he's gotten diverted to some high-priority short-term deliverables.

    RowExpression.From takes a function and (if possible) returns a data structure describing the syntax tree for that function. It's expected to work on the kind of function you might pass to Table.SelectRows -- in other words, unary and with references to the sole row parameter. You can see this by comparing the output of the following:

    RowExpression.From(() => 1)
    RowExpression.From((r) => 1)
    RowExpression.From((r, s) => 1)

    It can be a little annoying to explore the output in Power Query, unfortunately, and I can't give you a better tool.

    Edit: Here's a quick-and-dirty conversion of the AST to JSON: https://gist.github.com/CurtHagenlocher/dceef4a19a3124cb172244bca573cecc
    • Edited by Curt Hagenlocher Tuesday, March 6, 2018 11:28 PM Added link to example
    Tuesday, March 6, 2018 11:21 PM