<?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: &amp;quot;ORDER BY Distance&amp;quot; query does not work in &amp;quot;Find Slot&amp;quot; in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545717#M51519</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hey &lt;A rel="user" href="https://answers.flexsim.com/users/29555/yokotat.html" nodeid="29555"&gt;@Yokota T&lt;/A&gt;, it's true that in the sorting algorithm,&lt;/P&gt;&lt;PRE&gt;ORDER BY (slot.location.project(slot.storageObject, model()) - $1.as(Object).location.project($1.up, model())).magnitude ASC&lt;/PRE&gt;&lt;P&gt;the $1 is assumed to be something that can be interpreted as an Object (hence the ".as(Object)"). Although the $1 parameter defaults to token, you can change it to be whatever you'd like. In the picklist next to the $1 parameter, you can click on Token &amp;gt;&amp;gt; item to change it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1659730806718.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1511956i3A68A3556BC041B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="1659730806718.png" alt="1659730806718.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can use any of these possibilities; however, it's up to the person building the model to know what to put there. Flexsim was built trying to avoid making any assumptions about what the user may want to put. We just try to provide a framework for you to build models effectively &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 05 Aug 2022 20:22:10 GMT</pubDate>
    <dc:creator>kavika_faleumu</dc:creator>
    <dc:date>2022-08-05T20:22:10Z</dc:date>
    <item>
      <title>"ORDER BY Distance" query does not work in "Find Slot"</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545716#M51518</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 22.2.0 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Hello, all.&lt;/P&gt;
 &lt;P&gt;In the property of Find Slot activity, I set the query to "ORDER BY/ Distance from Object." &lt;/P&gt;
 &lt;P&gt;However, when I ran the simulation, an exception occurred. The message is as follows.&lt;/P&gt;
 &lt;PRE&gt;time: 10.859958 exception: SQL Evaluation Exception: FlexScript exception thrown in evaluation of code. Code is: ((param(1).as(Storage.Slot).location.project(param(2).as(Storage.Slot).storageObject,model())) - (param(3).as(Object).location.project(param(4).up,model()))).magnitude. Forwarding throw.
time: 10.859958 exception: SqlQuery - FlexScript Exception in: ORDER BY (slot.location.project(slot.storageObject, model()) - $1.as(Object).location.project($1.up, model())).magnitude ASC&lt;/PRE&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;I think it is because the query assumes that $1 contains token.item, but the default $1 contains token.&lt;/P&gt;
 &lt;P&gt;Thank you.&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Aug 2022 07:17:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545716#M51518</guid>
      <dc:creator>yokota_t</dc:creator>
      <dc:date>2022-08-05T07:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: "ORDER BY Distance" query does not work in "Find Slot"</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545717#M51519</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hey &lt;A rel="user" href="https://answers.flexsim.com/users/29555/yokotat.html" nodeid="29555"&gt;@Yokota T&lt;/A&gt;, it's true that in the sorting algorithm,&lt;/P&gt;&lt;PRE&gt;ORDER BY (slot.location.project(slot.storageObject, model()) - $1.as(Object).location.project($1.up, model())).magnitude ASC&lt;/PRE&gt;&lt;P&gt;the $1 is assumed to be something that can be interpreted as an Object (hence the ".as(Object)"). Although the $1 parameter defaults to token, you can change it to be whatever you'd like. In the picklist next to the $1 parameter, you can click on Token &amp;gt;&amp;gt; item to change it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1659730806718.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1511956i3A68A3556BC041B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="1659730806718.png" alt="1659730806718.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can use any of these possibilities; however, it's up to the person building the model to know what to put there. Flexsim was built trying to avoid making any assumptions about what the user may want to put. We just try to provide a framework for you to build models effectively &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Aug 2022 20:22:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545717#M51519</guid>
      <dc:creator>kavika_faleumu</dc:creator>
      <dc:date>2022-08-05T20:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: "ORDER BY Distance" query does not work in "Find Slot"</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545718#M51520</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/35833/kavikaf.html" nodeid="35833"&gt;@Kavika F&lt;/A&gt; , Thank you for your response. That makes sense. This notation is easier to change if the label name is other than "item." &lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Aug 2022 08:51:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/quot-order-by-distance-quot-query-does-not-work-in-quot-find/m-p/13545718#M51520</guid>
      <dc:creator>yokota_t</dc:creator>
      <dc:date>2022-08-08T08:51:15Z</dc:date>
    </item>
  </channel>
</rss>

