01-25-2020
08:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-25-2020
08:05 AM
This is another way to do it:
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 < oStrings.Count
Result = False
Try
prop = iProperties.Value("Custom", oStrings(i))
Catch
MessageBox.Show("The iProperty: [ " & oStrings(i) & " ] 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 FunctionIt does the checking in a Private function, that returns to your main rule As a Boolean response. 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. It also handles missing iProperties by prompting the missing property name before returning a False Boolean.