Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nbn88
Regular Visitor

Can't convert text value to list

Hi All,


I am trying to loop through my first collum to fill every row in an OData link. see code below:

 

 

 

let
    
    Source = [id],
    
    ProcessItem = (item) =>
        let

            ODataLink = "https://api.api.com/api/example/" & Text.From(item) & "/value",
            
            Result = OData.Feed(ODataLink)
        in
            Result,

    Results = List.Transform(Source, each ProcessItem(_))
in
    Results

 

 

 

However my code brings the following error: Expression.error: Can't convert value "1234567" to type list.

 

My function is returning text so why does List.Transform give me this error?

 

If anyone has suggestions please let me know, thanks in advance!

 

4 REPLIES 4
Anonymous
Not applicable

Hi, @nbn88 

 

Based on your description, you can try this.

let
    YourTableName = YourActualTableName, // Replace with your actual table name
    Source = Table.Column(YourTableName, "id"),
    ProcessItem = (item) =>
        let
            ODataLink = "https://api.api.com/api/example/" & Text.From(item) & "/value",
            Result = OData.Feed(ODataLink)
        in
            Result,
    Results = List.Transform(Source, each ProcessItem(_))
in
    Results

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

This query gives me the error: UnexpectedXmlElement : The schema element 'NavigationProperty' was not expected in the given context. When i manually enter the query with a fixed value it does work. So there must be something with formatting the value?

Ahmedx
Super User
Super User

pls try this

  Source = {[id]}, // convert to list
    
    ProcessItem = (item) =>
        let

            ODataLink = "https://api.api.com/api/example/" & Text.From(item) & "/value",
            
            Result = OData.Feed(ODataLink)
        in
            Result,

    Results = List.Transform(Source, each ProcessItem(_))
in
    Results

Thanks for your suggestion, however i now get the following error: The metadata document could not be read from the message content

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.