<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help with Error when applying schema when API returns null records in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-Error-when-applying-schema-when-API-returns-null/m-p/3411508#M44223</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;The below example shows whenever I have location = null, it throws an error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeFields_0-1693596163674.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/963673i8ECE6DE8A3FBCD44/image-size/large?v=v2&amp;amp;px=999" role="button" title="JoeFields_0-1693596163674.png" alt="JoeFields_0-1693596163674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is a condensed listing of how I am defining my schema in my PQ file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have defined location as being a nullable record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I copied the Table.ChangeType helper function from here:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-query/helper-functions#tablechangetype" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/power-query/helper-functions#tablechangetype&lt;/A&gt;. I also have been following the TripPin examples to build out my connector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ProjectType = type table [
...
    location = nullable any,
...],&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeFields_0-1696280976223.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/975806iCB4E2A2A7DAE5A8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeFields_0-1696280976223.png" alt="JoeFields_0-1696280976223.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeFields_1-1696280993734.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/975807i649A313E2DD7D9CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeFields_1-1696280993734.png" alt="JoeFields_1-1696280993734.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 21:15:26 GMT</pubDate>
    <dc:creator>JoeFields</dc:creator>
    <dc:date>2023-10-02T21:15:26Z</dc:date>
    <item>
      <title>Help with Error when applying schema when API returns null records</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-Error-when-applying-schema-when-API-returns-null/m-p/3411508#M44223</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;The below example shows whenever I have location = null, it throws an error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeFields_0-1693596163674.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/963673i8ECE6DE8A3FBCD44/image-size/large?v=v2&amp;amp;px=999" role="button" title="JoeFields_0-1693596163674.png" alt="JoeFields_0-1693596163674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is a condensed listing of how I am defining my schema in my PQ file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have defined location as being a nullable record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I copied the Table.ChangeType helper function from here:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-query/helper-functions#tablechangetype" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/power-query/helper-functions#tablechangetype&lt;/A&gt;. I also have been following the TripPin examples to build out my connector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ProjectType = type table [
...
    location = nullable any,
...],&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeFields_0-1696280976223.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/975806iCB4E2A2A7DAE5A8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeFields_0-1696280976223.png" alt="JoeFields_0-1696280976223.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoeFields_1-1696280993734.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/975807i649A313E2DD7D9CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoeFields_1-1696280993734.png" alt="JoeFields_1-1696280993734.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 21:15:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-Error-when-applying-schema-when-API-returns-null/m-p/3411508#M44223</guid>
      <dc:creator>JoeFields</dc:creator>
      <dc:date>2023-10-02T21:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error when applying schema with nullable records</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-Error-when-applying-schema-when-API-returns-null/m-p/3411513#M44224</link>
      <description>&lt;P&gt;This appears to be similar to this previous unanswered post from a few years ago:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Power-Query/Error-with-nullable-record-type-when-using-Table-ChangeType/m-p/940504#M32453" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Power-Query/Error-with-nullable-record-type-when-using-Table-ChangeType/m-p/940504#M32453&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 19:30:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-Error-when-applying-schema-when-API-returns-null/m-p/3411513#M44224</guid>
      <dc:creator>JoeFields</dc:creator>
      <dc:date>2023-09-01T19:30:14Z</dc:date>
    </item>
  </channel>
</rss>

