<?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 Can I use an SQL query in an activity? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556273#M59807</link>
    <description>&lt;P&gt;&lt;I&gt;[ FlexSim 17.2.5 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Good morning at all!&lt;/P&gt;
&lt;P&gt;In my model I have a global table composed by a column that define the level of the rack and another column that define the coordinate z of the level.&lt;/P&gt;
&lt;P&gt;In an activity I would like to find the level of the rack using the coordinate. I tried to use a cicle while and a cicle for connected to the global table, but when the token pass the second time from the activity, the result is completely wrong.&lt;/P&gt;
&lt;P&gt;So I would like to use an sql query to find the row of the global table which have the values that I need, not using the various cicle. The z coordinate to search in saved in a variable.&lt;/P&gt;
&lt;P&gt;My questions are: 1) is possible to write the code in an activity? 2) do you have any ideas how to set the code?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;I attach my code. The activities involved in my research are the two "&lt;EM&gt;Travel_LiftToTier"&lt;/EM&gt; in the right side of the model &lt;/P&gt;
&lt;P&gt;&lt;A id="14341" href="https://answers.flexsim.com/storage/attachments/14341-10-vs3-mgneg.fsm"&gt;10-vs3-mgneg.fsm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Sep 2018 06:59:53 GMT</pubDate>
    <dc:creator>marco_b8</dc:creator>
    <dc:date>2018-09-17T06:59:53Z</dc:date>
    <item>
      <title>Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556273#M59807</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 17.2.5 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Good morning at all!&lt;/P&gt;
&lt;P&gt;In my model I have a global table composed by a column that define the level of the rack and another column that define the coordinate z of the level.&lt;/P&gt;
&lt;P&gt;In an activity I would like to find the level of the rack using the coordinate. I tried to use a cicle while and a cicle for connected to the global table, but when the token pass the second time from the activity, the result is completely wrong.&lt;/P&gt;
&lt;P&gt;So I would like to use an sql query to find the row of the global table which have the values that I need, not using the various cicle. The z coordinate to search in saved in a variable.&lt;/P&gt;
&lt;P&gt;My questions are: 1) is possible to write the code in an activity? 2) do you have any ideas how to set the code?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;I attach my code. The activities involved in my research are the two "&lt;EM&gt;Travel_LiftToTier"&lt;/EM&gt; in the right side of the model &lt;/P&gt;
&lt;P&gt;&lt;A id="14341" href="https://answers.flexsim.com/storage/attachments/14341-10-vs3-mgneg.fsm"&gt;10-vs3-mgneg.fsm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 06:59:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556273#M59807</guid>
      <dc:creator>marco_b8</dc:creator>
      <dc:date>2018-09-17T06:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556274#M59808</link>
      <description>&lt;A rel="user" href="https://answers.flexsim.com/users/9029/marcob8.html" nodeid="9029"&gt;@Marco B8&lt;/A&gt;&lt;P&gt;I have reattached the model with the changes.&lt;/P&gt;&lt;P&gt;I updated the query to get row number of the table based on the z coordinate value.&lt;/P&gt;&lt;PRE&gt;Table result = Table.query("SELECT table.ROW_NUMBER FROM table WHERE z = $1",zsh1);
int rowNum = result[1][1]; &lt;/PRE&gt;&lt;P&gt;&lt;A id="14346" href="https://answers.flexsim.com/storage/attachments/14346-getrownumber.fsm"&gt;getrownumber.fsm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:27:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556274#M59808</guid>
      <dc:creator>raja_sekaran</dc:creator>
      <dc:date>2018-09-17T09:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556275#M59809</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/885/raja.s.html" nodeid="885"&gt;@Raja Sekaran&lt;/A&gt;!&lt;/P&gt;
&lt;P&gt;Thanks for your idea, but it doesn't work in my model. I attach the error that I found.&lt;/P&gt;
&lt;P&gt;&lt;A id="14347" href="https://answers.flexsim.com/storage/temp/14347-error.png"&gt;error.png&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:43:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556275#M59809</guid>
      <dc:creator>marco_b8</dc:creator>
      <dc:date>2018-09-17T09:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556276#M59810</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/9029/marcob8.html" nodeid="9029"&gt;@Marco B8&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It works well for me.&lt;/P&gt;&lt;P&gt;Does query return the value? Or it throws some exception.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:46:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556276#M59810</guid>
      <dc:creator>raja_sekaran</dc:creator>
      <dc:date>2018-09-17T09:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556277#M59811</link>
      <description>&lt;P&gt;It returns to me this exeption:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;time: 60.000000 exception: FlexScript exception: No resolved tables at MODEL:/Tools/ProcessFlow/ProcessFlow/Travel_LiftToTier~3&amp;gt;variables/involved1&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:48:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556277#M59811</guid>
      <dc:creator>marco_b8</dc:creator>
      <dc:date>2018-09-17T09:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556278#M59812</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/9029/marcob8.html" nodeid="9029"&gt;@Marco B8&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Could you attach the model?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:50:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556278#M59812</guid>
      <dc:creator>raja_sekaran</dc:creator>
      <dc:date>2018-09-17T09:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556279#M59813</link>
      <description>&lt;P&gt;Pay attention only that in the "script" I have the code for create the objects.&lt;/P&gt;
&lt;P&gt;&lt;A id="14348" href="https://answers.flexsim.com/storage/attachments/14348-10-vs3-mgneg-prova.fsm"&gt;10-vs3-mgneg-prova.fsm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Really thank you for your help!!!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:54:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556279#M59813</guid>
      <dc:creator>marco_b8</dc:creator>
      <dc:date>2018-09-17T09:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556280#M59814</link>
      <description>&lt;A rel="user" href="https://answers.flexsim.com/users/9029/marcob8.html" nodeid="9029"&gt;@Marco B8&lt;/A&gt;&lt;P&gt;This exception already exists in the model, not because of the query which we updated recently. Currently, you have 6 "&lt;EM&gt;Travel_LiftToTier" &lt;/EM&gt;activity in the model. In that, we have updated the query in the two of those. To find out the root cause, please update the name of the activity for those 6 "Travel_LiftToTier" like "Travel_LiftToTier1","Travel_LiftToTier2" etc.,&lt;/P&gt;&lt;P&gt;This will help us to identify which activity throws an exception.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 10:24:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556280#M59814</guid>
      <dc:creator>raja_sekaran</dc:creator>
      <dc:date>2018-09-17T10:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556281#M59815</link>
      <description>&lt;P&gt;I changed the name as you suggest, but the exception remains:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;time: 60.000000 exception: FlexScript exception: No resolved tables at MODEL:/Tools/ProcessFlow/ProcessFlow/3.1Travel_LiftToTier&amp;gt;variables/involved1&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I attach the model with the modify to the name.&lt;/P&gt;
&lt;P&gt;&lt;A id="14349" href="https://answers.flexsim.com/storage/temp/14349-10-vs3-mgneg-prova.fsm"&gt;10-vs3-mgneg-prova.fsm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 11:18:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556281#M59815</guid>
      <dc:creator>marco_b8</dc:creator>
      <dc:date>2018-09-17T11:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an SQL query in an activity?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556282#M59816</link>
      <description>&lt;P&gt;In the global table I haven't numbered the rows: could be this a problem?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 11:35:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/can-i-use-an-sql-query-in-an-activity/m-p/13556282#M59816</guid>
      <dc:creator>marco_b8</dc:creator>
      <dc:date>2018-09-17T11:35:06Z</dc:date>
    </item>
  </channel>
</rss>

