<?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 Re: Create DirectQuery Datasest with XMLA Endpoint doesn't automatically select gateway in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Create-DirectQuery-Datasest-with-XMLA-Endpoint-doesn-t/m-p/3444383#M44639</link>
    <description>&lt;P&gt;If this is important to you please consider voting for an existing idea or raising a new one at &lt;A href="https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41" target="_blank" rel="noopener"&gt;https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also this:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/take-over-in-group" target="_blank"&gt;Datasets - Take Over In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Sep 2023 20:37:03 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-09-23T20:37:03Z</dc:date>
    <item>
      <title>Create DirectQuery Datasest with XMLA Endpoint doesn't automatically select gateway</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-DirectQuery-Datasest-with-XMLA-Endpoint-doesn-t/m-p/3443031#M44626</link>
      <description>&lt;P&gt;I am currently building a directquery dataset via code and xmla endpoint.&amp;nbsp; I have been able to create the dataset in my workspace however when I navigate to the online dataset it doesn't have the gateway connections automatically set.&amp;nbsp; I have to then takeover the dataset, navigate to gateways and then it will auto fill out the correct gateway.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there a way I can do this in code?&amp;nbsp; Below is what I'm seeing and then the code I am using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When first created there are no tables:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then after I navigate to settings, click on take over settings, and open gateway and cloud connections it automatically finds the correct connection and loads it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I navigate back and the tables are already filled in.&amp;nbsp; The only thing I did was takeover and navigate to the connection.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can do this via code so that this is automatically done?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;  public static void CreateWingtipSalesModel(Database database) {

    Model model = database.Model;

 

          Table tableCustomers = CreateCustomersTable();
  
          model.Tables.Add(tableCustomers);
 

         model.SaveChanges();

    model.RequestRefresh(RefreshType.Full);
    model.SaveChanges();
  }
  
  
    private static Table CreateCustomersTable()
  {

      Table customersTable = new Table()
      {
          Name = "Case",
          Description = "Case table",
          Partitions = {
              new Partition() {
          Name = "All Cases",
          Mode = ModeType.DirectQuery,
          Source = new MPartitionSource() {
              Expression = Properties.Resources.CustomersQuery_m

          }
      }
  },
          Columns = {
      new DataColumn() { Name = "Case_ID", DataType = DataType.Int64, SourceColumn = "Case_ID", IsHidden=false },
      new DataColumn() { Name = "Category", DataType = DataType.String, SourceColumn = "Category" }

  }
      };



      return customersTable;
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Customers Query M code is below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Sql.Database("CONNECTION", "DATABASE", [MultiSubnetFailover=true]),
    FieldProc_vwCase = Source{[Schema="dbo",Item="table"]}[Data]
in
    dbo_table&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Sep 2023 12:26:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-DirectQuery-Datasest-with-XMLA-Endpoint-doesn-t/m-p/3443031#M44626</guid>
      <dc:creator>Clampazzo</dc:creator>
      <dc:date>2023-09-22T12:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create DirectQuery Datasest with XMLA Endpoint doesn't automatically select gateway</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-DirectQuery-Datasest-with-XMLA-Endpoint-doesn-t/m-p/3444383#M44639</link>
      <description>&lt;P&gt;If this is important to you please consider voting for an existing idea or raising a new one at &lt;A href="https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41" target="_blank" rel="noopener"&gt;https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also this:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/take-over-in-group" target="_blank"&gt;Datasets - Take Over In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 20:37:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-DirectQuery-Datasest-with-XMLA-Endpoint-doesn-t/m-p/3444383#M44639</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-23T20:37:03Z</dc:date>
    </item>
  </channel>
</rss>

