Forum Discussion

lcunha's avatar
lcunha
Regular Visitor
4 years ago
Solved

Expression.Error We cannot convert the value List to type Text

Hi, I'm having trouble with this code right here:

 

 

let
    base_URL = "https://<company>.pipedrive.com/api/v1/deals/",
    Fonte = pip_Deals_IDs,
    pipedrive_table = "/products",
    admin_token = "<admin_token>",
    admin_token_URL = Text.Combine({"?api_token=",admin_token}),
    call_deal_products = Table.AddColumn(Fonte, "deal products",
    each let
        deal_id = Fonte[deal id],
        call_API = Text.Combine({base_URL,deal_id,pipedrive_table,admin_token_URL})
    in
        Json.Document(
        Web.Contents(call_API)
        ), 
    List.Type
    )
in

call_deal_products

 

The Query is returning an Expression.Error: 

 

 

 

 

Testing for one ID, the return should be like this:

 

 

let
    base_URL = "https://<company>.pipedrive.com/api/v1/deals/",
    Fonte = pip_Deals_IDs,
    deal_id = "1050",
    pipedrive_table = "/products",
    admin_token = "<admin_token>",
    admin_token_URL = Text.Combine({"?api_token=",admin_token}),
    call_API = Text.Combine({base_URL,deal_id,pipedrive_table,admin_token_URL}),
    call_deal_products = Json.Document(Web.Contents(call_API))
in

call_deal_products

 

 

 

The data that I'm trying to return is inside this list in the row called "data".

 

What am I getting wrong?

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi lcunha 

     

    This line, it is a list

    deal_id = Fonte[deal id],

    you can do 

    deal_id = [deal id],

     or make sure it is text

    deal_id = Text.From([deal id]),

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi lcunha 

     

    This line, it is a list

    deal_id = Fonte[deal id],

    you can do 

    deal_id = [deal id],

     or make sure it is text

    deal_id = Text.From([deal id]),