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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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