<?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: Do Loop to check multiple values and return a single result...maybe in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9273139#M104992</link>
    <description>&lt;P&gt;My initial test of the suggested solution seems to be working, but I found an error in the rules that set the iProperties that is causing a "no" result when it should be a "yes".&amp;nbsp; Unfortunately I've been forced into temporarily changing projects so I have to sit on this until I can continue debugging the rules.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jan 2020 18:08:02 GMT</pubDate>
    <dc:creator>jfenter</dc:creator>
    <dc:date>2020-01-24T18:08:02Z</dc:date>
    <item>
      <title>Do Loop to check multiple values and return a single result...maybe</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9269783#M104914</link>
      <description>&lt;P&gt;Through a series of rules, I am creating iProperties to show whether a certain condition exists or not.&amp;nbsp; Each of these properties will either end with a value of "Yes" or "No".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;iProperties.Value("Custom", "Width Configured?")
iProperties.Value("Custom", "Honeycomb Configured?")
iProperties.Value("Custom", "Inner Rail 1 Configured?")
iProperties.Value("Custom", "Inner Rail 2 Configured?")&lt;/PRE&gt;&lt;P&gt;I would like to create a rule to check the values of these 4 properties and perform one of two operations given the values of those properties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If any one of the 4 iproperties = "No" Then
	iLogicVb.RunRule("Width Check")
	iLogicVb.RunRule("Panel Length - No Rails")
ElseIf ALL 4 properites = "Yes" Then
        'MessageBox.Show("Part is properly configured.  No changes needed.", "Limit Check")
End If&lt;/PRE&gt;&lt;P&gt;I assume I need to run a Do Loop to check the values of the properties and return one of the two outcomes I have shown above.&amp;nbsp; If so, I don't know how to write the code.&amp;nbsp; If there is another way, which way is it?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 13:19:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9269783#M104914</guid>
      <dc:creator>jfenter</dc:creator>
      <dc:date>2020-01-23T13:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to check multiple values and return a single result...maybe</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9269898#M104918</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2309038"&gt;@jfenter&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would be a very simple solution for your problem &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oCount&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Integer&lt;/SPAN&gt; = 0
&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Value&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Width Configured?"&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oCount&lt;/SPAN&gt; += 1
&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Value&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Honeycomb Configured?"&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oCount&lt;/SPAN&gt; += 1
&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Value&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Inner Rail 1 Configured?"&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oCount&lt;/SPAN&gt; += 1
&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Value&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Inner Rail 2 Configured?"&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oCount&lt;/SPAN&gt; +=1

&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oCount&lt;/SPAN&gt; &amp;lt; 4
	&lt;SPAN style="color: #800080;"&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Width Check"&lt;/SPAN&gt;)
	&lt;SPAN style="color: #800080;"&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Panel Length - No Rails"&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;"Part is properly configured.  No changes needed."&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Limit Check"&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;</description>
      <pubDate>Thu, 23 Jan 2020 13:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9269898#M104918</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-01-23T13:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to check multiple values and return a single result...maybe</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9272928#M104986</link>
      <description>&lt;P&gt;I don't think that will work, because the values of the iProperties will be Strings, and iLogic doesn't implicitly convert strings to boolean. You could change the other rules to make the values of your iProperties either "True" or "False", or you could use the below code to evaluate the current values:&lt;/P&gt;&lt;PRE&gt;If LCase(iProperties.Value("Custom", "Width Configured?")) = "no" Or _
		LCase(iProperties.Value("Custom", "Honeycomb Configured?")) = "no" Or _
		LCase(iProperties.Value("Custom", "Inner Rail 1 Configured?")) = "no" Or _
		LCase(iProperties.Value("Custom", "Inner Rail 2 Configured?")) = "no" Then
	iLogicVb.RunRule("Width Check")
	iLogicVb.RunRule("Panel Length - No Rails")
Else
        MessageBox.Show("Part is properly configured.  No changes needed.", "Limit Check")
End If&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jan 2020 16:33:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9272928#M104986</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2020-01-24T16:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to check multiple values and return a single result...maybe</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9272950#M104988</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont see any reason not to use Yes/No-properties for this purpose.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 16:42:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9272950#M104988</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-01-24T16:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to check multiple values and return a single result...maybe</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9273139#M104992</link>
      <description>&lt;P&gt;My initial test of the suggested solution seems to be working, but I found an error in the rules that set the iProperties that is causing a "no" result when it should be a "yes".&amp;nbsp; Unfortunately I've been forced into temporarily changing projects so I have to sit on this until I can continue debugging the rules.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 18:08:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9273139#M104992</guid>
      <dc:creator>jfenter</dc:creator>
      <dc:date>2020-01-24T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop to check multiple values and return a single result...maybe</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9274330#M104998</link>
      <description>&lt;P&gt;This is another way to do it:&lt;/P&gt;&lt;PRE&gt;Sub Main
	Dim StringList As String() ={"Width Configured?", "Honeycomb Configured?", "Inner Rail 1 Configured?", "Inner Rail 2 Configured?"} '{"Test", "This"}
	
	If CheckThese(StringList) = False
		MessageBox.Show("Part is not properly configured.  Running rules now.", "Failed Limit Check")
'		iLogicVb.RunRule("Width Check")
'		iLogicVb.RunRule("Panel Length - No Rails")
	Else
		MessageBox.Show("Part is properly configured.  No changes needed.", "Passed Limit Check")
	End If
	
End Sub

Private Function CheckThese(oStrings As String()) As Boolean
	Dim i As Integer = 0
	While i &amp;lt; oStrings.Count
		Result = False
		Try
			prop = iProperties.Value("Custom", oStrings(i))
		Catch
			MessageBox.Show("The iProperty: [ " &amp;amp; oStrings(i) &amp;amp; " ] is missing from this part!", "Missing iProperty")
		    Result = False
			Exit While
		End Try
		If iProperties.Value("Custom", oStrings(i)) = True Then Result = True Else Exit While 
		i=i+1
	End While
	Return Result
End Function&lt;/PRE&gt;&lt;P&gt;It does the checking in a Private function, that returns to your main rule As a Boolean response.&amp;nbsp; It is set up so you can check any number of Yes/No iProperties, and returns a False Boolean at the first False value found.&amp;nbsp; It also handles missing iProperties by prompting the missing property name before returning a False Boolean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jan 2020 16:05:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-loop-to-check-multiple-values-and-return-a-single-result/m-p/9274330#M104998</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2020-01-25T16:05:03Z</dc:date>
    </item>
  </channel>
</rss>

