<?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: How to use SQL to find an available rack slot within a specific bay range in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512987#M25649</link>
    <description>&lt;P&gt;Hi &lt;A href="https://answers.flexsim.com/questions/76633/how-to-use-sql-to-find-an-available-rack-slot-with.html#"&gt;@tanner.p&lt;/A&gt;,
 thank you for the quick response. I tried this but it returns 
&amp;lt;no path&amp;gt;, which isn't the behavior I was expecting. I'm not using
 a table to represent the rack, so there is no column for bayNumber to 
refer to. Normally I can run the findSlot command using the Script 
Console and it returns a node like this:&lt;/P&gt;&lt;PRE&gt;Node: Rack1&amp;gt;variables/bays/29/levels/2/slots/1
&lt;/PRE&gt;&lt;P&gt;I'm looking for a way to write the SQL query in a way that 
doesn't use a variable but instead uses the rack's own storageObject 
properties so that it returns a node like above but limited to a specific bay range.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2019 19:47:49 GMT</pubDate>
    <dc:creator>jon_abbott</dc:creator>
    <dc:date>2019-12-16T19:47:49Z</dc:date>
    <item>
      <title>How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512985#M25647</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 20.0.0 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;I am using a SQL query similar to below to find an available rack slot in a specific rack:&lt;/P&gt;&lt;PRE&gt;Storage.system.findSlot("WHERE slot.storageObject.name = 'Rack1' ORDER BY RAND()",0)&lt;/PRE&gt;&lt;P&gt;How can I adjust this to only consider a specific range of bays within that rack? For example, assume Rack1 has 30 bays. I would like to have the SQL query only consider bays 5-10 of Rack1 for returning an available slot, and I would like to use SQL to accomplish this. Thanks in advance for any help you can provide.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 19:24:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512985#M25647</guid>
      <dc:creator>jon_abbott</dc:creator>
      <dc:date>2019-12-16T19:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512986#M25648</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/1130/jon.a.html" nodeid="1130"&gt;@Jon Abbott&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I think you can narrow your search using a BETWEEN statement in the code you have. Example:&lt;/P&gt;&lt;PRE&gt;Storage.system.findSlot("WHERE slot.storageObject.name = 'Rack1' AND bayNumber BETWEEN 5 AND 10 ORDER BY RAND()",0)&lt;/PRE&gt;&lt;P&gt;You would just need find how to access the appropriate column that represents the bay number.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 19:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512986#M25648</guid>
      <dc:creator>tanner_p</dc:creator>
      <dc:date>2019-12-16T19:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512987#M25649</link>
      <description>&lt;P&gt;Hi &lt;A href="https://answers.flexsim.com/questions/76633/how-to-use-sql-to-find-an-available-rack-slot-with.html#"&gt;@tanner.p&lt;/A&gt;,
 thank you for the quick response. I tried this but it returns 
&amp;lt;no path&amp;gt;, which isn't the behavior I was expecting. I'm not using
 a table to represent the rack, so there is no column for bayNumber to 
refer to. Normally I can run the findSlot command using the Script 
Console and it returns a node like this:&lt;/P&gt;&lt;PRE&gt;Node: Rack1&amp;gt;variables/bays/29/levels/2/slots/1
&lt;/PRE&gt;&lt;P&gt;I'm looking for a way to write the SQL query in a way that 
doesn't use a variable but instead uses the rack's own storageObject 
properties so that it returns a node like above but limited to a specific bay range.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 19:47:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512987#M25649</guid>
      <dc:creator>jon_abbott</dc:creator>
      <dc:date>2019-12-16T19:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512988#M25650</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/1130/jon.a.html" nodeid="1130"&gt;@Jon Abbott&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Bummer that didn't work. It seemed like the easiest thing to do.&lt;/P&gt;&lt;P&gt;I asked a colleague for an alternative suggestion and he thinks it might be easiest to use labels on the slots. This way, if you have certain slots that you want to pick from, you can still use SQL, but you'll look for slots with a specific label. I think this should work as long as you know beforehand which slots are go and which slots are no-go.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 20:03:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512988#M25650</guid>
      <dc:creator>tanner_p</dc:creator>
      <dc:date>2019-12-16T20:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512989#M25651</link>
      <description>&lt;P&gt;Thanks &lt;A href="https://answers.flexsim.com/questions/76633/how-to-use-sql-to-find-an-available-rack-slot-with.html#"&gt;@tanner.p&lt;/A&gt;.
 It seems redundant to add labels to each slot that indicate which bay 
it is, when the bay number is already a property of the slot... in the 
documentation, there is an entry for Storage.Object.bays... is there a 
way to reference this using SQL?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 20:17:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512989#M25651</guid>
      <dc:creator>jon_abbott</dc:creator>
      <dc:date>2019-12-16T20:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512990#M25652</link>
      <description>&lt;PRE&gt;Storage.system.findSlot("WHERE slot.storageObject.name = 'Rack1' AND slot.bayID BETWEEN 5 AND 10 ORDER BY RAND()",0)&lt;/PRE&gt;&lt;P&gt;When you use the "slot." prefix, it assumes you are accessing the slot as a Storage.Slot FlexScript object, so you can access any of the members available in that &lt;A href="https://docs.flexsim.com/en/20.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Warehousing/Storage.Slot.html"&gt;interface&lt;/A&gt;. From the manual:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"If the slot's storage object has an Address Scheme, the slot's bay ID is formatted according to that address scheme. In other words, if the address scheme's bays are addressed with a letter, bayID will be a string, otherwise bayID will be a number. If there is no address scheme, bayID will be the bay number."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I assume you are not using an address scheme, or if you are, the bays are defined by numbers. Thus, in your case you can assume slot.bayID will give you back a number, so you can use BETWEEN in SQL.&lt;/P&gt;&lt;P&gt;The other, more verbose, way to access the rank of the bay would be:&lt;/P&gt;&lt;PRE&gt;Storage.system.findSlot("WHERE slot.storageObject.name = 'Rack1' AND slot.bay.as(treenode).rank BETWEEN 5 AND 10 ORDER BY RAND()",0)&lt;/PRE&gt;&lt;P&gt;This will directly access the rank of the bay, which may be useful if you expressly don't want to use bayID, e.g. if you've set up an address scheme that doesn't give you ranks.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 21:09:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512990#M25652</guid>
      <dc:creator>anthony_johnsonT83CM</dc:creator>
      <dc:date>2019-12-16T21:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL to find an available rack slot within a specific bay range</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512991#M25653</link>
      <description>&lt;P&gt;Great, thanks for explaining how this works, &lt;A rel="user" href="https://answers.flexsim.com/users/207/anthony.j.html" nodeid="207"&gt;@anthony.johnson&lt;/A&gt;. This behaves exactly how I would expect. I had consulted the manual but hadn't discovered the Storage.Slot page yet. Your explanation helps to tie it all together.&lt;BR /&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/207/anthony.j.html" nodeid="207"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 21:51:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-use-sql-to-find-an-available-rack-slot-within-a-specific/m-p/13512991#M25653</guid>
      <dc:creator>jon_abbott</dc:creator>
      <dc:date>2019-12-16T21:51:22Z</dc:date>
    </item>
  </channel>
</rss>

