Search code examples
excelpowerquerym

Documentation on arguments and return values of arbitrary PowerQuery functions


Lets take https://learn.microsoft.com/en-us/powerquery-m/table-splitcolumn as an example. This function takes splitter as function as it's third argument. Now how do I know what arguments and/or return values this splitter has (ie. what's the signature of the splitter function)? Where can I check that?

Surely I can navigate here https://learn.microsoft.com/en-us/powerquery-m/splitter-functions and take any function from there as an example but unfortunately those functions return the actual splitter function, which again is ambiguous.

I'm asking as I would like to either create my own splitter or be able to use that splitter in my own logic; thus I need to know what arguments I am to expect to be passed to a splitter function.


Solution

  • Are you familiar with #shared? Maybe it might help you.

    Try these two queries out:

    let
        Source = #shared,
        #"Converted to Table" = Record.ToTable(Source),
        #"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "Table.SplitColumn")),
        Value = #"Filtered Rows"{0}[Value]
    in
        Value
    

    Which gives you: enter image description here

    let
        Source = #shared,
        #"Converted to Table" = Record.ToTable(Source),
        #"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "Splitter.SplitTextByDelimiter")),
        Value = #"Filtered Rows"{0}[Value]
    in
        Value
    

    Which gives you: enter image description here