<?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 How to find the first row that has a particular value in a specific column in a global table? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549262#M54256</link>
    <description>&lt;P&gt;&lt;I&gt;[ FlexSim 16.2.1 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Hi, I want a token to read the values in a column of a global table, and return the first row that has the value 0.0 in that column. I would appreciate any suggestions regarding if there is a command or code that I can use on custom code in process flow?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2016 18:36:13 GMT</pubDate>
    <dc:creator>sanaz_karamimoghaddam</dc:creator>
    <dc:date>2016-11-21T18:36:13Z</dc:date>
    <item>
      <title>How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549262#M54256</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 16.2.1 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Hi, I want a token to read the values in a column of a global table, and return the first row that has the value 0.0 in that column. I would appreciate any suggestions regarding if there is a command or code that I can use on custom code in process flow?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 18:36:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549262#M54256</guid>
      <dc:creator>sanaz_karamimoghaddam</dc:creator>
      <dc:date>2016-11-21T18:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549263#M54257</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/1112/sanaz.k.html" nodeid="1112"&gt;@sanaz karamimoghaddam&lt;/A&gt; An off the cuff solution... you could set a label "column value" and read the first row in the table for that column, then have a decide node if the value equals 0 then set a label "row number" to be 1, but if not then repeat the loop but increment the "row number" by 1 until it finds the solution. i realize you asked for code in the custom code so this may not be what you were looking for. &lt;A href="https://answers.flexsim.com/storage/temp/3850-row0.fsm"&gt;row0.fsm&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 19:07:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549263#M54257</guid>
      <dc:creator>kari_payton</dc:creator>
      <dc:date>2016-11-21T19:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549264#M54258</link>
      <description>&lt;P&gt;I would use a "for loop" in your logic to search the table for the first value that reads 0.   You could use something like this code to achieve that:&lt;/P&gt;&lt;PRE&gt;int returnRow = 0;
int returnCol = 0;
for (int col=1; col&amp;lt;gettablecols("GlobalTable1"); col++)   {
	for (int row=1; row&amp;lt;gettablerows("GlobalTable1"); row++)  {
		if (gettablenum("GlobalTable1",row,col)==0)  {
			returnRow = row;
			returnCol = col;
			break;
		}
	}
}
&lt;/PRE&gt;&lt;P&gt;This will parse through each row and column of the table until it finds a cell that equals 0.   Then it will assign the row and column to the returnRow and returnCol variables, which you can use in your logic.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 20:13:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549264#M54258</guid>
      <dc:creator>sam_stubbsYXX86</dc:creator>
      <dc:date>2016-11-21T20:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549265#M54259</link>
      <description>&lt;P&gt;You can use the query command. It would look something like:&lt;/P&gt;&lt;PRE&gt;query("FROM GlobalTable1 WHERE ColumnName == 0");
int matchedRow = getquerymatchtablerow("GlobalTable1", 1);
&lt;/PRE&gt;&lt;P&gt;If you want to know how many rows matched you would use:&lt;/P&gt;&lt;PRE&gt;int count = getquerymatchcount();&lt;/PRE&gt;&lt;P&gt;If count &amp;gt; 1 then you can use the second parameter in getquerymatchtablerow() to give you the row values of all of the matches. If count can ever equal 0, you'll need to check the count before calling getquerymatchtablerow() as passing in an invalid index will result in an exception being thrown.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 20:24:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549265#M54259</guid>
      <dc:creator>matt_long</dc:creator>
      <dc:date>2016-11-21T20:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549266#M54260</link>
      <description>&lt;P&gt;Thanks for your response &lt;A rel="user" href="https://answers.flexsim.com/users/614/sam.s.html" nodeid="614"&gt;@Sam Stubb &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/614/sam.s.html" nodeid="614"&gt;&lt;/A&gt;in this code, if I already know the column that it needs to check for, should I say: &lt;/P&gt;
&lt;PRE&gt;for (int row=1; row&amp;lt;gettablerows("GlobalTable1"); row++)  {
for (int col=1;) {&lt;!-- --&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Nov 2016 21:59:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549266#M54260</guid>
      <dc:creator>sanaz_karamimoghaddam</dc:creator>
      <dc:date>2016-11-21T21:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549267#M54261</link>
      <description>&lt;P&gt;Yes just eliminate the outer for loop if you've already got the column.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 22:02:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549267#M54261</guid>
      <dc:creator>sam_stubbsYXX86</dc:creator>
      <dc:date>2016-11-21T22:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549268#M54262</link>
      <description>&lt;P&gt;Thanks for your response &lt;A rel="user" href="https://answers.flexsim.com/users/730/kari.p.html" nodeid="730"&gt;@Kari Payton&lt;/A&gt;, That would work too, but my model is too crowded already so I am trying to do things with minimum labels of such nature. &lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 22:03:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549268#M54262</guid>
      <dc:creator>sanaz_karamimoghaddam</dc:creator>
      <dc:date>2016-11-21T22:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549269#M54263</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/614/sam.s.html" nodeid="614"&gt;@Sam Stubbs&lt;/A&gt; and &lt;A rel="user" href="https://answers.flexsim.com/users/201/matt.l.html" nodeid="201"&gt;@Matt Long&lt;/A&gt; Thank you both for your answer! &lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 22:07:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549269#M54263</guid>
      <dc:creator>sanaz_karamimoghaddam</dc:creator>
      <dc:date>2016-11-21T22:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549270#M54264</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/201/matt.l.html" nodeid="201"&gt;@Matt Long&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;is "count", a predefined variable since it appears in blue, or should it be another name?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 23:49:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549270#M54264</guid>
      <dc:creator>sanaz_karamimoghaddam</dc:creator>
      <dc:date>2016-11-21T23:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549271#M54265</link>
      <description>&lt;P&gt;You can use count. It's blue because there are some special commands that pass values into count like findmatch(). But it works just like item and current or i, you can use it wherever.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 23:58:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549271#M54265</guid>
      <dc:creator>matt_long</dc:creator>
      <dc:date>2016-11-21T23:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549272#M54266</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;DIV class="fr-view clearfix"&gt;
  &lt;P&gt;Hello, I need some help with the coding on flexsim I am an absolute beginner and was wondering if anyone knew the coding language for the statement below&lt;/P&gt;
  &lt;P&gt;//Go to Global table&lt;/P&gt;
  &lt;P&gt;//Look at Row 1&lt;/P&gt;
  &lt;P&gt;// Check Column 1 value&lt;/P&gt;
  &lt;P&gt;// If value &amp;gt;0, then value = value -1&lt;/P&gt;
  &lt;P&gt;// Result = column number (holding area 1 output port 1 connected to staging area 1&lt;/P&gt;
  &lt;P&gt;// Break loop&lt;/P&gt;
  &lt;P&gt;// Else&lt;/P&gt;
  &lt;P&gt;// Check column 2 value&lt;/P&gt;
  &lt;P&gt;// Loop&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sat, 09 May 2020 08:33:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549272#M54266</guid>
      <dc:creator>benjamin_h3</dc:creator>
      <dc:date>2020-05-09T08:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the first row that has a particular value in a specific column in a global table?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549273#M54267</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/22449/benjaminh3.html" nodeid="22449"&gt;@Benjamin H3&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for using FlexSim. Please follow our community Best Practices that are posted in the top right corner and post this in a new question. Thank you!&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 11 May 2020 13:02:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-find-the-first-row-that-has-a-particular-value-in-a/m-p/13549273#M54267</guid>
      <dc:creator>braydn_t</dc:creator>
      <dc:date>2020-05-11T13:02:29Z</dc:date>
    </item>
  </channel>
</rss>

