<?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: Export new added row from global table to SQL database in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549377#M54365</link>
    <description>&lt;DIV class="fr-view clearfix"&gt; 
 &lt;P&gt;Thanks &lt;A rel="user" href="https://answers.flexsim.com/users/13461/benjaminw2.html" nodeid="13461"&gt;@Benjamin W2&lt;/A&gt; for your consideration,this code worked well for me to write in MysqlDatabase : &lt;/P&gt; 
 &lt;P&gt;Database.Connection con = Database.Connection("DBConnector1");&lt;/P&gt; 
 &lt;P&gt;con.connect();&lt;/P&gt; 
 &lt;P&gt;Database.PreparedStatement statement = con.prepareStatement("INSERT INTO Table1 (id) VALUES (:id )");&lt;/P&gt; 
 &lt;P&gt; statement.bindParam("id", Table("Date DG")&lt;TABLE&gt;[1], &lt;A rel="nofollow noopener noreferrer" href="http://Database.DataType.Int" target="_blank"&gt;Database.DataType.Int&lt;/A&gt;);&lt;P&gt;&lt;/P&gt; 
 &lt;P&gt;statement.execute();&lt;/P&gt; 
 &lt;P&gt;con.disconnect();&lt;/P&gt; 
&lt;/TABLE&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 19 May 2020 09:08:30 GMT</pubDate>
    <dc:creator>farah_a</dc:creator>
    <dc:date>2020-05-19T09:08:30Z</dc:date>
    <item>
      <title>Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549368#M54356</link>
      <description>&lt;P&gt;Greeting everyone, &lt;/P&gt;
&lt;P&gt; I have built a model in which I add rows and columns in a global table using process flow. &lt;/P&gt;
&lt;P&gt;I want to export the added row simultaneously in my sql table, this means each time a row is added in my global table, it should be added at the same time in my database.&lt;/P&gt;
&lt;P&gt;My question is how can i automatically export the data without having to do it manually from DBconnector ? what trigger is needed ?&lt;/P&gt;
&lt;P&gt;i have basic knowledge in sql, which query can help me do that ? &lt;/P&gt;
&lt;P&gt;Thank you for your help folks&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 15:48:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549368#M54356</guid>
      <dc:creator>farah_a</dc:creator>
      <dc:date>2020-03-25T15:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549369#M54357</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/18224/faraha.html" nodeid="18224"&gt;@Farah A&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;To add a new column, I think you could execute SQL code like what's below:&lt;/P&gt;&lt;PRE&gt;ALTER TABLE MyTable
ADD NewColumn varchar(255);&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;You would just execute it at the same time the new column is created. I'm not entirely sure the best way to do this, though. It's just an idea.&lt;/P&gt;&lt;P&gt;As for automatically exporting all this data, you might look at &lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/questions/58276/how-to-export-flexsim-table-to-excel-file.html" target="_blank"&gt;this question&lt;/A&gt; or at the User Manual section entitled, "Excel Interface".&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 16:25:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549369#M54357</guid>
      <dc:creator>tanner_p</dc:creator>
      <dc:date>2020-03-25T16:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549370#M54358</link>
      <description>&lt;P&gt;thanks for your answer. but i want it to add the data that are in my global table. i can do this by exporting it in my DBConnectors but i want it to be added each time there's a new value&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 16:54:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549370#M54358</guid>
      <dc:creator>farah_a</dc:creator>
      <dc:date>2020-03-25T16:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549371#M54359</link>
      <description>&lt;P&gt;No trigger is going to fire when you add a row to a global table. If you want to export after adding the row, then you need to adjust your code everywhere you add a row to add the row and then also export.&lt;/P&gt;&lt;P&gt;You could wrap those two operations together into a user command if you wanted.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 19:49:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549371#M54359</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2020-03-25T19:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549372#M54360</link>
      <description>&lt;P&gt;okay, i hva tried to put a command that can do that, add a row and export data in a custome code but i'm having this error and i dont know what does that mean ? &lt;/P&gt;
&lt;P&gt;&lt;A id="26887" href="https://answers.flexsim.com/storage/temp/26887-sql-code.png"&gt;sql-code.png&lt;/A&gt;&lt;A id="26888" href="https://answers.flexsim.com/storage/temp/26888-error.png"&gt;error.png&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 09:55:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549372#M54360</guid>
      <dc:creator>farah_a</dc:creator>
      <dc:date>2020-03-31T09:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549373#M54361</link>
      <description>&lt;P&gt;That error means exactly what it says:&lt;/P&gt;&lt;PRE&gt;Data type Database.DataType does not support property Integer.&lt;/PRE&gt;&lt;P&gt;You have to use one of the values available in &lt;A href="https://docs.flexsim.com/en/20.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Database.DataType.html"&gt;Database.DataType&lt;/A&gt;. Database.DataType.Integer isn't in that list. &lt;A href="https://docs.flexsim.com/en/20.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Database.DataType.html"&gt;Database.DataType.Int&lt;/A&gt; is. Depending on how your database is configured, you might need SmallInt, BigInt, or Numeric for that field.&lt;/P&gt;&lt;P&gt;Also, why are you calling con.disconnect() from that code when you aren't calling connect() from that code?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 15:27:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549373#M54361</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2020-03-31T15:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549374#M54362</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; does not the command Database.Connection con = Database.Connection("DBConnector1"); do the connection with database ? &lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 07:36:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549374#M54362</guid>
      <dc:creator>farah_a</dc:creator>
      <dc:date>2020-04-01T07:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549375#M54363</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://answers.flexsim.com/users/18224/faraha.html" nodeid="18224"&gt;@Farah A&lt;/A&gt; &lt;/P&gt;&lt;P&gt;That creates an instance of the Database object. You still need to call the connect method to establish a connection. There is an example here in the documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.flexsim.com/en/20.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Database.PreparedStatement.html"&gt;https://docs.flexsim.com/en/20.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Database.PreparedStatement.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 13:28:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549375#M54363</guid>
      <dc:creator>braydn_t</dc:creator>
      <dc:date>2020-04-01T13:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549376#M54364</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/18224/faraha.html" nodeid="18224"&gt;@Farah A&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Do you still need help with this?&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 May 2020 19:59:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549376#M54364</guid>
      <dc:creator>benjamin_w2</dc:creator>
      <dc:date>2020-05-18T19:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Export new added row from global table to SQL database</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549377#M54365</link>
      <description>&lt;DIV class="fr-view clearfix"&gt; 
 &lt;P&gt;Thanks &lt;A rel="user" href="https://answers.flexsim.com/users/13461/benjaminw2.html" nodeid="13461"&gt;@Benjamin W2&lt;/A&gt; for your consideration,this code worked well for me to write in MysqlDatabase : &lt;/P&gt; 
 &lt;P&gt;Database.Connection con = Database.Connection("DBConnector1");&lt;/P&gt; 
 &lt;P&gt;con.connect();&lt;/P&gt; 
 &lt;P&gt;Database.PreparedStatement statement = con.prepareStatement("INSERT INTO Table1 (id) VALUES (:id )");&lt;/P&gt; 
 &lt;P&gt; statement.bindParam("id", Table("Date DG")&lt;TABLE&gt;[1], &lt;A rel="nofollow noopener noreferrer" href="http://Database.DataType.Int" target="_blank"&gt;Database.DataType.Int&lt;/A&gt;);&lt;P&gt;&lt;/P&gt; 
 &lt;P&gt;statement.execute();&lt;/P&gt; 
 &lt;P&gt;con.disconnect();&lt;/P&gt; 
&lt;/TABLE&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 19 May 2020 09:08:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/export-new-added-row-from-global-table-to-sql-database/m-p/13549377#M54365</guid>
      <dc:creator>farah_a</dc:creator>
      <dc:date>2020-05-19T09:08:30Z</dc:date>
    </item>
  </channel>
</rss>

