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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
JoeFields
Frequent Visitor

Help with Error when applying schema when API returns null records

I am getting errors on Record type objects when I try to apply a schema in my custom connector even though I have added the nullable type identifier in the schema.

The below example shows whenever I have location = null, it throws an error.

JoeFields_0-1693596163674.png

Here is a condensed listing of how I am defining my schema in my PQ file:

 

ProjectType = type table [
...
    location = nullable LocationType,
...],
    LocationType = type [
        country = text,
        state = text,
        streetName = text,
        streetNumber = text,
        suite = text,
        city = text,
        zip = text,
        complete = text,
        coords = nullable CoordsType
    ]

 

I have defined location as being a nullable record.

 

I copied the Table.ChangeType helper function from here: https://learn.microsoft.com/en-us/power-query/helper-functions#tablechangetype. I also have been following the TripPin examples to build out my connector.

 

If I change the schema definition to nullable any then it works but then I do not have my schema applied for the location records that are provided.

 

ProjectType = type table [
...
    location = nullable any,
...],

 

 

The REST API I am connecting to sometimes has the location records filled in but sometimes location is just null as in the below examples:

JoeFields_0-1696280976223.pngJoeFields_1-1696280993734.png

 

I can't figure out where in the Table.ChangeType helper function I can make a tweak to cover the null record conditions but I would have thought making it nullable would have done the trick. Any thoughts?

 

1 REPLY 1
JoeFields
Frequent Visitor

This appears to be similar to this previous unanswered post from a few years ago: https://community.fabric.microsoft.com/t5/Power-Query/Error-with-nullable-record-type-when-using-Tab...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.