Maria628
Maria628

Reputation: 234

power query: convert a value of Function output to Text

i wrote 2 power query functions and main function will have a sub function (with input argument):

### main query - Query1 ###
let
    my = Query2, ===> no error until here
    K = Text.Split(my, ",") ===> Error occurred at this place
in
    K
 
### sub query - Query2 ###
let
    output =
        (AccountID as text) as text =>
        let
            x = AccountID
        in
            x
in
    output

My idea is to call main query which parses the sub query function Query2 (input argument for example Hello,World) and print the output from it, but it throws an error

Error: We cannot convert a value of type Function to type Text.

let
    my = Query2
in
    my

input prompt works fine for above main function query and it just prints the input argument i pass. but issue is at line ==> K = Text.Split(my, ",") which i am not sure how to convert that function output to a text format.

Upvotes: 0

Views: 1071

Answers (1)

horseyride
horseyride

Reputation: 21318

my = Query2 generates nothing since the function is written as

(AccountID as text) as text =>

and that requires being called with input, like

= Query2("123456") 

Query1 doesnt provide that input, so nothing is returned for the next step and thus the next step generates an error

You can see this by clicking on step one of Query1 on the right side of screen. It just shows the function, not the result of the function

enter image description here

Upvotes: 0

Related Questions