I-Logic Boolean

I-Logic Boolean

didin.suryadi6JREK
Advocate Advocate
1,274 Views
3 Replies
Message 1 of 4

I-Logic Boolean

didin.suryadi6JREK
Advocate
Advocate

HI

 

I created short i-logic to take some shortcut from Custome Iproperties, on Boolean option with Yes/No input text on text box the result is always came out with Yes, Cant change to No.

 

Below the i-logic form.

 

Dim propertyName3 As String = "Laser Cut"
Dim propertyValue3 As Boolean = True 
InputBox ("Laser Cut:", "Set Property", "Yes")

Try
	prop = customPropertySet.Item(propertyName3)
Catch
	customPropertySet.Add(propertyValue3, propertyName3)

End Try

If propertyValue3 = True Then 
	iProperties.Value("Custom", propertyName3) = True
Else If propertyValue3 = False Then 
	iProperties.Value("Custom", propertyName3) = False

End If

 When i input No in inputbox it always come up with Yes

 

Rgds

 

Didin 

0 Likes
Accepted solutions (1)
1,275 Views
3 Replies
Replies (3)
Message 2 of 4

JhoelForshav
Mentor
Mentor
Accepted solution

@didin.suryadi6JREK 

You're not using the value from the inputbox as the code is written now...

Try this 🙂

Dim propertyName3 As String = "Laser Cut"
Dim valString As String = InputBox("Laser Cut:", "Set Property", "Yes")
Dim propertyValue3 As Boolean = If (valString = "Yes", True, False)
Try
	prop = customPropertySet.Item(propertyName3)
Catch
	prop = customPropertySet.Add(propertyValue3, propertyName3)
End Try

iProperties.Value("Custom", propertyName3) = propertyValue3
0 Likes
Message 3 of 4

JhoelForshav
Mentor
Mentor

The entire code can however be rewritten to one single line though, since iProperties.Value creates the property if it doesn't already exist.

 

iProperties.Value("Custom", "Laser Cut") = If (InputBox("Laser Cut:", "Set Property", "Yes") = "Yes", True, False)
Message 4 of 4

didin.suryadi6JREK
Advocate
Advocate

Thank You sir, you're the best

0 Likes