PDM API search for blanks

I am working on a test for a search tool and have a need to search for items that have blank (nothing, empty, or null) variables. With the below I would like to get only files that have blank for Hinge Qty but right now I get all files, regardless of there value. any way around this?

Sub SearchForFileVariable()

Dim MYarray(2, 2) As String

Set Search = Vault.CreateSearch

MYarray(0, 0) = "Description"

MYarray(0, 1) = "REAR FRAME ASSY"

MYarray(1, 0) = "Door Type"

MYarray(1, 1) = "ROLL-UP"

MYarray(2, 0) = "Hinge Qty"

MYarray(2, 1) = ""

i = 0

Do While i < 3

Search.AddVariable MYarray(i, 0), MYarray(i, 1)

i = i + 1

Loop

FindFiles = True

Search.FindFolders = False

Search.SetToken Edmstok_AllVersions, False

Set Result = Search.GetFirstResult

End Sub

SolidworksApi/macros
Answers 4
DS
DS 2021-04-09 Best Answer

Try Chr(32) instead of ""

The US ASCII Character Set

DW
DW 2021-04-09

That works!

using  Search.AddVariable "Hinge Qty", vbNullString 

I only got files that have a "Hinge Qty"  that is Null.

Thanks!

AB
AB 2021-04-09

I have no idea if this is actually a variable but looking up how to do this with Excel VBA states to use vbnullstring.

DW
DW 2021-04-09

No go with Chr(32). I tried Chr(0) too, got the same as "". Thanks anyways!