locked
Passing table as text RRS feed

  • Question

  • Hello, I am trying to create a function that will replace all errors in all columns, but I cannot figure out how to pass a table by the text name.  

    Invoking the function returns this line "= #"fnReplaceErrors (2)"("tTest")", which does not work.

    However, it will work after manually removing the quotes around tTest. "= #"fnReplaceErrors (2)"(tTest)"

    Will someone please help?

    let fnReplaceErrors = ( src as any ) =>
        let
            cols = Table.ColumnNames(src),
            replace = Table.ReplaceErrorValues(src, List.Transform(cols, each {_, "!"}))
        in
            replace
    in
        fnReplaceErrors

    Original Code Source

    Tuesday, January 24, 2017 6:23 PM

Answers

  • Why would you want to pass a table as text?

    Your function works fine (I tried) if you define src as table, not as any.

    • Marked as answer by Uziel9999 Wednesday, January 25, 2017 1:45 AM
    Tuesday, January 24, 2017 8:36 PM

All replies

  • Why would you want to pass a table as text?

    Your function works fine (I tried) if you define src as table, not as any.

    • Marked as answer by Uziel9999 Wednesday, January 25, 2017 1:45 AM
    Tuesday, January 24, 2017 8:36 PM
  • Thank you.  I was testing it by invoking the function, which means I typed in the name of the table, but it did not work.  However, it does work nicely when included in a normal query.  ;)

    Wednesday, January 25, 2017 1:46 AM