<?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 get the index of a particular value/entry in a list? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444780#M69275</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Here are a couple of ways to handle your question.&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// My solution when list items are expressions
myList = {paramter1, parameter2, parameter3, Splparameter, parameterN, parameterEnd};

For( i = 1, i &amp;lt;= N Items( mylist ), i++,
	If( myList[i] == Parse( "Splparameter" ),
		Break()
	)
);
Show( i );

// If elements are strings the contains can be used
myList = {"paramter1", "parameter2", "parameter3", "Splparameter", "parameterN", "parameterEnd"};
i = Contains( myList, "Splparameter" );

//  Same using Loc() function
i = loc(mylist,"Splparameter" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Dec 2021 05:59:50 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-12-14T05:59:50Z</dc:date>
    <item>
      <title>How to get the index of a particular value/entry in a list?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444727#M69269</link>
      <description>&lt;P&gt;I have the following list, how do I get the index of SplPparameter?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myList = {paramter1, parameter2, parameter3, Splparameter, parameterN, parameterEnd};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Ans is 4&amp;nbsp; in the above example.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:07:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444727#M69269</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-09T18:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the index of a particular value/entry in a list?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444780#M69275</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Here are a couple of ways to handle your question.&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// My solution when list items are expressions
myList = {paramter1, parameter2, parameter3, Splparameter, parameterN, parameterEnd};

For( i = 1, i &amp;lt;= N Items( mylist ), i++,
	If( myList[i] == Parse( "Splparameter" ),
		Break()
	)
);
Show( i );

// If elements are strings the contains can be used
myList = {"paramter1", "parameter2", "parameter3", "Splparameter", "parameterN", "parameterEnd"};
i = Contains( myList, "Splparameter" );

//  Same using Loc() function
i = loc(mylist,"Splparameter" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Dec 2021 05:59:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444780#M69275</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-12-14T05:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the index of a particular value/entry in a list?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444803#M69279</link>
      <description>&lt;P&gt;In the case of expressions, you can also use 'Loc()' (which returns a column vector):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

myList = {paramter1, parameter2, parameter3, Splparameter, parameterN, parameterEnd, Splparameter};
Print(loc(mylist, Expr(Splparameter)));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Dec 2021 17:24:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444803#M69279</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-12-14T17:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the index of a particular value/entry in a list?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444944#M69289</link>
      <description>&lt;P&gt;If you know that the items are expressions, then this shorter code will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// My solution when list items are expressions
myList = {paramter1, parameter2, parameter3, Splparameter, parameterN, parameterEnd};
Contains( myList, Expr( Splparameter ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, then you need a more general code like the one provided by&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 14:02:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-the-index-of-a-particular-value-entry-in-a-list/m-p/444944#M69289</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-12-14T14:02:23Z</dc:date>
    </item>
  </channel>
</rss>

