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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
MarkusEng1998
Resolver II
Resolver II

API loop with List.Empty - access column from previous step

Thanks to @lbendlin, I found a tip to terminate an API loop with List.Empty.

 

However my reference to the projNo column in the List.Generate() is erroring when I expand the table list.api 2024-05-03_08-41-37.jpg

 

#"02ListGenerate = Table.AddColumn(#"01filterProject", "dRofusRecord", each List.Generate(() =>
		[proj = [projNo], skip = 0,  top = 50, recordList = getURI(proj, top, skip)],

		each not List.IsEmpty([recordList]),
	
		each [proj=[projNo],
			skip = [skip] + [top], 
			top = [top],
			recordList = getURI(proj, top, skip)]
))

Thank you for any guidance.

1 ACCEPTED SOLUTION

In the List.Generate() I changed proj=[projNo] to projNo = [projNo].

This now works!

 

= Table.AddColumn(#"01filterProject", "dRofusRecord", each List.Generate(() =>
[projNo = [projNo], skip = 0,  top = 50, recordList = getURI(projNo, top, skip)],

each not List.IsEmpty([recordList]),

each [projNo = [projNo],
      skip = [skip] + [top], 
      top = [top],
       recordList = getURI(projNo, top, skip)]
))

 

Thank you again @lbendlin for prompting the question. I appreciate this forum because submitting the question forces me to better understand the "problem statement."

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

What's the error message?

Expression.Error: The field 'projNo' of the record wasn't found.

api 2024-05-03_09-20-24.jpg

 

getURI()

(projNo as text, topVal as number, skipVal as number)=>
let
    #"FilterColumnTable" = Table.SelectRows(#"102APImapRooms100", each ([ObjectType] = "rooms")),
    GetWebContents =
        Web.Contents(
            "https://api-us.drofus.com/api/company/",
            [
                RelativePath= projNo
                & "/rooms" 
                & "?$select=" & Text.Combine(#"FilterColumnTable"[dRofus.ID], ",")
                & "&$top=" & Number.ToText(topVal)
                & "&$skip=" & Number.ToText(skipVal) 
            ]
        ),
    convertedJson = Json.Document(GetWebContents,65001),     
        in
            convertedJson

In the List.Generate() I changed proj=[projNo] to projNo = [projNo].

This now works!

 

= Table.AddColumn(#"01filterProject", "dRofusRecord", each List.Generate(() =>
[projNo = [projNo], skip = 0,  top = 50, recordList = getURI(projNo, top, skip)],

each not List.IsEmpty([recordList]),

each [projNo = [projNo],
      skip = [skip] + [top], 
      top = [top],
       recordList = getURI(projNo, top, skip)]
))

 

Thank you again @lbendlin for prompting the question. I appreciate this forum because submitting the question forces me to better understand the "problem statement."

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.