<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>&amp;quot;Export-DataTableToSQLiteDB : DataTable already belongs to another DataSet.&amp;quot;</title><link>https://communities.bentley.com/products/projectwise/f/projectwise-powershell-extensions-forum/215525/export-datatabletosqlitedb-datatable-already-belongs-to-another-dataset</link><description>I&amp;#39;m using PWPS_PWDM (which works pretty well) to gather info from Deliverables Management. With some assistance getting set up, I have been able to get a Submittals information dataset sorted into datatables, and from there into Excel. I&amp;#39;d like to just</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: "Export-DataTableToSQLiteDB : DataTable already belongs to another DataSet."</title><link>https://communities.bentley.com/thread/656566?ContentTypeID=1</link><pubDate>Tue, 22 Jun 2021 00:45:35 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:f13b6bf0-f69e-408b-98b6-a4f81d9d5e90</guid><dc:creator>Matt Blumenfeld</dc:creator><description>&lt;p&gt;Perhaps I spoke a little too soon. I am able to export the tables to a SQLite database, but it doesn&amp;#39;t like the ID fields at all.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using this:&lt;/p&gt;
&lt;p&gt;foreach ($table in $TransmittalsDataSet.Tables)&lt;br /&gt;{&lt;br /&gt; New-XLSXWorkbook -InputTables $table -OutputFileName D:\temp\DM\TransmittalsExportTest.xlsx&lt;br /&gt;# Copy the table&lt;br /&gt; $table_copy = $table.Copy()&lt;br /&gt;# Export the table to SQLite&lt;br /&gt; Export-DataTableToSQLiteDB -OutputFolder d:\temp -SourceDataTable $table_copy -OutputFileName SqlLiteTest3.db -append #-InputTable $table_copy &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;And when it&amp;#39;s done, the&amp;nbsp;ID Fields look like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343592/pastedimage1624322499774v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Have you run across this before? Is it because I am trying to output to SQLite, or am I forgetting some sort of transformation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Export-DataTableToSQLiteDB : DataTable already belongs to another DataSet."</title><link>https://communities.bentley.com/thread/656519?ContentTypeID=1</link><pubDate>Mon, 21 Jun 2021 17:13:24 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:dbd87304-9e43-4e71-b866-527c49a094c2</guid><dc:creator>Matt Blumenfeld</dc:creator><description>&lt;p&gt;Thanks, Zachary. That&amp;#39;s even easier.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Export-DataTableToSQLiteDB : DataTable already belongs to another DataSet."</title><link>https://communities.bentley.com/thread/656301?ContentTypeID=1</link><pubDate>Mon, 21 Jun 2021 00:48:17 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5bfd0afc-d2da-4567-a979-64c6bd84825d</guid><dc:creator>Zachary Kerr</dc:creator><description>&lt;p&gt;Hey Matt, glad you got it working.&lt;br /&gt;A simple solution is to just copy the whole data table. Something like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;foreach ($table in $Dataset.Tables)
{
    $table_copy = $table.Copy()
    Do-Whatever -InputTable $table_copy
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That will save you having to rebuild the tables and populate row by row.&lt;br /&gt;Hope this helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: "Export-DataTableToSQLiteDB : DataTable already belongs to another DataSet."</title><link>https://communities.bentley.com/thread/656300?ContentTypeID=1</link><pubDate>Sun, 20 Jun 2021 23:38:21 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5bd6625f-96e2-4c35-a543-86cf2e787451</guid><dc:creator>Matt Blumenfeld</dc:creator><description>&lt;p&gt;It appears that the solution was to go away for a little while and then come back with a fresh mindset.  &lt;/p&gt;
&lt;p&gt;Upon returning I had a &amp;quot;Duh&amp;quot; moment and created a new datatable with the same columns as the source one, copied the rows into the new datatable and then I had one that didn&amp;#39;t &amp;quot;already belong to a dataset&amp;quot;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>