syntax help needed - value found -value not found

syntax help needed - value found -value not found

tracey
Enthusiast Enthusiast
625 Views
6 Replies
Message 1 of 7

syntax help needed - value found -value not found

tracey
Enthusiast
Enthusiast

Hi, I wonder if anyone can help me.   This code defaults to value found.

 

If foundVal = MultiValue.FindValue(MultiValue.List("DoorLowerC"), "=", Parameter("Door_Lower"))
    MessageBox.Show("Door Lower C Value found", "Value found", MessageBoxButtons.OK)
Else
    foundVal = MultiValue.FindValue(MultiValue.List("DoorLowerC"), "=", " ")
    MessageBox.Show("No value found", "No Match", MessageBoxButtons.OK)
End If

 I am trying to say:  if  a value in list DoorLowerC matches the parameter Door_Lower then msg box, value found but if a matching value cannot be found, then msg box, not found.

 

Please help if you can

Many thanks

 

 

 

626 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

You need to add the "unit" string (mm deg ul etc..)

 

If foundVal = MultiValue.FindValue(MultiValue.List("DoorLowerC"), "=", Parameter("Door_Lower")&"mm")
    MessageBox.Show("Door Lower C Value found", "Value found", MessageBoxButtons.OK)
Else
    foundVal = MultiValue.FindValue(MultiValue.List("DoorLowerC"), "=", "" )
    MessageBox.Show("No value found", "No Match", MessageBoxButtons.OK)
End If

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

bradeneuropeArthur
Mentor
Mentor

your search string should be exactly like in the multi-value list.

like:

1mm

or 

1 mm

or 

1deg

or

1 deg

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 7

tracey
Enthusiast
Enthusiast

Thank you for your help.  Very appreciated.  Actually, I think I have this wrong by putting text at the end.  It doesn't stop the rule running though and my problem is that both text boxes show ' as found' when only A should give this result. 

 

Any ideas on what I am doing wrong?

 

I have posted the code here:

 

MultiValue.SetValueOptions(True, DefaultIndex := 0)
Dim Door_Lower As String
'current value KK
Dim Door_Upper As String
'current value L
MultiValue.SetList("Door", "DoorA_E6Both","DoorB_E2E4Both","DoorC_E6Lower","DoorD_E6Upper")
MultiValue.SetList("DoorA_E6Both",  "AA", "BB", "CC", "DD", "EE", "FF", "GG", "HH", "II", "JJ", "KK", "LL", "MM", "NN", "OO", "PP", "QQ")
MultiValue.SetList("DoorB_E2E4Both",  "GG", "HH", "MM", "NN", "G", "H", "M", "N")
MultiValue.SetList("DoorC_E6Lower",  "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P")
MultiValue.SetList("DoorD_E6Upper",  "A", "B", "C", "D", "E", "F", "I", "J", "K", "L", "O", "P", "GG", "HH", "MM", "NN")

'[
 If foundVal = MultiValue.FindValue(MultiValue.List("DoorA_E6Both"), "=", Parameter("Door_Lower")&"Text") Then
    MessageBox.Show("Door Lower A Value found", "Value found", MessageBoxButtons.OK)
Else
    foundVal = MultiValue.FindValue(MultiValue.List("DoorLowerC"), "<>",Parameter("Door_Lower")&"Text")
    MessageBox.Show("No value found", "No Match", MessageBoxButtons.OK)
End If 

If foundVal = MultiValue.FindValue(MultiValue.List("DoorC_E6Lower"), "=", Parameter("Door_Lower")&"Text") Then
    MessageBox.Show("Door Lower C Value found", "Value found", MessageBoxButtons.OK)
Else
    foundVal = MultiValue.FindValue(MultiValue.List("DoorLowerC"), "<>",Parameter("Door_Lower")&"Text")
    MessageBox.Show("No value found", "No Match", MessageBoxButtons.OK)
End If 
 

 

 

Message 5 of 7

dusan.naus.trz
Advisor
Advisor

I would also like to know where the mistake is. I think the functionality doesn't support text.

0 Likes
Message 6 of 7

JelteDeJong
Mentor
Mentor

It works for strings. There is another problem here. The variable "foundVal"(1) is "Nothing" because it was never set. The function "MultiValue.FindValue()"(2) will return "Nothing" or the found value. So if the value is not found it will return Nothing and that is compared with the other Nothing. So that evaluates to True. On the other hand, if the value is found it returns the value and that is compared with the Nothing. That evaluates to False.

JelteDeJong_0-1645224971276.png

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 7 of 7

dusan.naus.trz
Advisor
Advisor
0 Likes