Using a variable as a placeholder for greater/less than in iLogic

Using a variable as a placeholder for greater/less than in iLogic

Anonymous
Not applicable
593 Views
5 Replies
Message 1 of 6

Using a variable as a placeholder for greater/less than in iLogic

Anonymous
Not applicable

Is it possible to have a variable contain the logical operator ">" or "<" to pass through a function? 

0 Likes
594 Views
5 Replies
Replies (5)
Message 2 of 6

mcgyvr
Consultant
Consultant

I don't believe so as the variable would be a string and fail in the boolean conversion..

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 3 of 6

johnsonshiue
Community Manager
Community Manager

Hi! I am sorry I am not sure I follow the request. Could you show an example of a variable containing logical operator? Isn't it an expression?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 4 of 6

Anonymous
Not applicable

I mean a variable that would take the place of the ">" or "<" in a comparison. 

0 Likes
Message 5 of 6

mcgyvr
Consultant
Consultant

@Anonymous wrote:

I mean a variable that would take the place of the ">" or "<" in a comparison. 


I assumed you wanted to do something like this..

myNumber = InputBox("Enter a Number", "iLogic", "25")

mygator = "<"
If (24 & mygator & myNumber) 
	MessageBox.Show("greater than 24", "iLogic")
Else
MessageBox.Show("less than 24", "iLogic")
End If


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 6 of 6

Anonymous
Not applicable

Yes, something like that. That text results in a "conversion from string" error when I try to run it.

 

I have a function that includes an IF statement where it would be helpful to change the comparison operators between <, >, and = when the function gets called.

 

I'm getting around it right now by writing out all of the IF cases within a case-select structure and passing a numerical variable to jump straight to the right IF case.

0 Likes