<?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: If statement checking for multiple strings in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10261863#M50611</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9966445"&gt;@will_roe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you use {} bracket it is identified as an array inside iLogic or VB.Net, that is why you are getting an error, as in the first-line you are defining a variable not an array, try below code instead and see if this helps you. You need to write like shown in Bold characters, to check multiple strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ID_1_CHAR&lt;/SPAN&gt; = &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"IDTAG"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oID1&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;((&lt;SPAN&gt;ID_1_CHAR&lt;/SPAN&gt;), 1)


&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;STRONG&gt;(oID1 &amp;lt;&amp;gt; "H" Or oID1 &amp;lt;&amp;gt; "V" Or oID1 &amp;lt;&amp;gt; "H")&lt;/STRONG&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"First character must be M, H or V"&lt;/SPAN&gt;, &lt;SPAN&gt;"Incorrect Input"&lt;/SPAN&gt;)
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"IDTAG"&lt;/SPAN&gt;) = &lt;SPAN&gt;"H1234"&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Apr 2021 05:21:52 GMT</pubDate>
    <dc:creator>dutt.thakar</dc:creator>
    <dc:date>2021-04-23T05:21:52Z</dc:date>
    <item>
      <title>If statement checking for multiple strings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10261813#M50610</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like this should be simple but I've searched all I can think of to do it correctly but can't find a answer. I just want a if statement to check to see if the first character is correct and show a message box and set a parameter if it's not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting a 1-dimensional array of String'&amp;nbsp; error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #800000;"&gt;ID_1_CHAR&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;IDTAG&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oID1&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;Left&lt;/SPAN&gt;((&lt;SPAN style="color: #800000;"&gt;ID_1_CHAR&lt;/SPAN&gt;), 1)


&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oID1&lt;/SPAN&gt; &amp;lt;&amp;gt; {&lt;SPAN style="color: #008080;"&gt;"H"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Or&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"V"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Or&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"H"&lt;/SPAN&gt;} &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Show&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"First character must be M, H or V"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Incorrect Input"&lt;/SPAN&gt;)
&lt;SPAN style="color: #0000ff;"&gt;IDTAG&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"H1234"&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 04:47:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10261813#M50610</guid>
      <dc:creator>will_roe</dc:creator>
      <dc:date>2021-04-23T04:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: If statement checking for multiple strings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10261863#M50611</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9966445"&gt;@will_roe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you use {} bracket it is identified as an array inside iLogic or VB.Net, that is why you are getting an error, as in the first-line you are defining a variable not an array, try below code instead and see if this helps you. You need to write like shown in Bold characters, to check multiple strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ID_1_CHAR&lt;/SPAN&gt; = &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"IDTAG"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oID1&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;((&lt;SPAN&gt;ID_1_CHAR&lt;/SPAN&gt;), 1)


&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;STRONG&gt;(oID1 &amp;lt;&amp;gt; "H" Or oID1 &amp;lt;&amp;gt; "V" Or oID1 &amp;lt;&amp;gt; "H")&lt;/STRONG&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"First character must be M, H or V"&lt;/SPAN&gt;, &lt;SPAN&gt;"Incorrect Input"&lt;/SPAN&gt;)
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"IDTAG"&lt;/SPAN&gt;) = &lt;SPAN&gt;"H1234"&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 05:21:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10261863#M50611</guid>
      <dc:creator>dutt.thakar</dc:creator>
      <dc:date>2021-04-23T05:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: If statement checking for multiple strings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10270655#M50612</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6518271"&gt;@dutt.thakar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't seem to be working as expected - the message box shows with any input. It seems to work fine if I have a single variable like the below.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;  &lt;STRONG&gt;oID1 &amp;lt;&amp;gt; "H" &lt;/STRONG&gt;&lt;SPAN&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I think I've misunderstood how the statement will work? Is the below just checking if oID1 doesn't = all of the values (H, V &amp;amp; M) So even if oID1 = H the statement will trip up because it doesn't = V or M?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;STRONG&gt;(oID1 &amp;lt;&amp;gt; "H" Or oID1 &amp;lt;&amp;gt; "V" Or oID1 &amp;lt;&amp;gt; "M")&lt;/STRONG&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will work for my purposes but I'm wondering if there's a more elegant way to write it?&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #800000;"&gt;ID_1_CHAR&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"IDTAG"&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oID1&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;Left&lt;/SPAN&gt;((&lt;SPAN style="color: #800000;"&gt;ID_1_CHAR&lt;/SPAN&gt;), 1)


&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;oID1&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"H"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Or&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oID1&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"V"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Or&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oID1&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"M"&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
&lt;SPAN style="color: #808080;"&gt;'Insert code here&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Show&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"It worked"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Title"&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;Else&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Show&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"First character must be M, H or V"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Incorrect Input"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800080;"&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"IDTAG"&lt;/SPAN&gt;) = &lt;SPAN style="color: #008080;"&gt;"H1234"&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 04:01:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10270655#M50612</guid>
      <dc:creator>will_roe</dc:creator>
      <dc:date>2021-04-27T04:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: If statement checking for multiple strings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10270790#M50613</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9966445"&gt;@will_roe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok, I think below is another way which is quite easy to write (Using Select Case) and understand and may serve your purpose as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ID_1_CHAR&lt;/SPAN&gt; = &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"IDTAG"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oID1&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;((&lt;SPAN&gt;ID_1_CHAR&lt;/SPAN&gt;), 1)&lt;BR /&gt;
&lt;SPAN&gt;Select&lt;/SPAN&gt; &lt;SPAN&gt;oID1&lt;/SPAN&gt;
&lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;"H"&lt;/SPAN&gt;, &lt;SPAN&gt;"M"&lt;/SPAN&gt;, &lt;SPAN&gt;"V"&lt;/SPAN&gt;
	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"It worked"&lt;/SPAN&gt;, &lt;SPAN&gt;"Title"&lt;/SPAN&gt;)
&lt;SPAN&gt;Case&lt;/SPAN&gt; &lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"First character must be M, H or V"&lt;/SPAN&gt;, &lt;SPAN&gt;"Incorrect Input"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;        Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"IDTAG"&lt;/SPAN&gt;) = "H1234"
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Select&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;See if this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 05:36:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10270790#M50613</guid>
      <dc:creator>dutt.thakar</dc:creator>
      <dc:date>2021-04-27T05:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: If statement checking for multiple strings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10270798#M50614</link>
      <description>&lt;P&gt;Awesome, thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6518271"&gt;@dutt.thakar&lt;/a&gt; !&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 05:43:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/if-statement-checking-for-multiple-strings/m-p/10270798#M50614</guid>
      <dc:creator>will_roe</dc:creator>
      <dc:date>2021-04-27T05:43:41Z</dc:date>
    </item>
  </channel>
</rss>

