Proper syntax for Greater than, less than, etc. in Select Case statements?

Proper syntax for Greater than, less than, etc. in Select Case statements?

Anonymous
Not applicable
2,208 Views
3 Replies
Message 1 of 4

Proper syntax for Greater than, less than, etc. in Select Case statements?

Anonymous
Not applicable

so I'm trying to write an iLogic rule that fills out a nice list of the different sizes a part can be produced in in an Excel file, but I'm having some issues getting the Case statement to run properly with the different ranges of values. I get an error that says' XML Literal cannot appear here unless it is enclosed in parentheses'. here is my lines of code, what am I doing wrong here?

 

SyntaxEditor Code Snippet

GoExcel.Open("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet1")

MessageBox.Show(SheetMetal.FlatExtentsArea, "FlatArea")



Select Case Parameter("Table_Length")
Case >= 12 And < 24
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B2") = SheetMetal.FlatExtentsArea
Case >=24 And <36
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B3") = SheetMetal.FlatExtentsArea
Case >=36 And <48
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B4") = SheetMetal.FlatExtentsArea
Case >=48 And <60
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B5") = SheetMetal.FlatExtentsArea
Case >=60 And <72
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B6") = SheetMetal.FlatExtentsArea
Case >=72 And <84
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B7") = SheetMetal.FlatExtentsArea
Case >=84 And <96
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B8") = SheetMetal.FlatExtentsArea
Case >=96 And <108
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B9") = SheetMetal.FlatExtentsArea
Case >=108 And <120
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B10") = SheetMetal.FlatExtentsArea
Case >=120 And <132
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B11") = SheetMetal.FlatExtentsArea
Case >=132 And <144
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B12") = SheetMetal.FlatExtentsArea
Case 144
	GoExcel.CellValue("Catalog Sheet - Dbl Roll Table 1.xlsx", "Sheet3", "B13") = SheetMetal.FlatExtentsArea
End Select

GoExcel.Save
GoExcel.Close

MessageBox.Show("FlatArea Updated", "Notice:")

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

johnsonshiue
Community Manager
Community Manager

Hi! I guess you miss "Is" in the condition of Case. Please take a look the following reference.

 

https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/select-case-state...

 

Many thanks!



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

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous,

 

Try something like this:

 

oLength = Parameter("Table_Length")

Select Case oLength
Case oLength >= 12 And oLength < 24
'etc.....
End Select

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 4 of 4

HermJan.Otterman
Advisor
Advisor
Accepted solution

Case 50 to 100  will also work...

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes