By Wayne Brill
You can specify a filter for the Select Entity dialog by using the ConfigureFilters() method on the SelectEntitySettings class. This method accepts a collection of EntityFilters which describe the behavior of each filter you want to supply to the dialog. Although the SDK doesn’t include an example of calling this method, it does provide a sample on how to create EntityFilters in the VaultBrowserSample app. (The Form1() constructor creates several entity filters).
After creating filters as in the sample pass the collection of filters to the SelectEntitySettings via the ConfigureFilters() method. You can see this done in the code example below.
Here is the SelectEntity dialog with the filters:
Dim oFolder As ACW.Folder =
m_conn.WebServiceManager.DocumentService.GetFolderByPath("$/Inventor_Files_WB/")
Dim myInventorFileFolder As New Framework.Vault.Currency.Entities.Folder(m_conn, oFolder)
Dim filters() As Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter = { _
New Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter _
("Project Files (*.ipj)", ".+ipj", Vault.Currency.Entities.EntityClassIds.Files), _
New Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter _
("Part Files (*.ipt)", ".+ipt", Vault.Currency.Entities.EntityClassIds.Files)
}
Dim initialFilter As New Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter _
("Part Files (*.ipt)", ".+ipt", Vault.Currency.Entities.EntityClassIds.Files)
Dim EntSettings As Framework.Vault.Forms.Settings.SelectEntitySettings =
New Framework.Vault.Forms.Settings.SelectEntitySettings()
With EntSettings
.ActionableEntityClassIds.Add("FILE")
.DialogCaption = "Select part"
.MultipleSelect = False
.ConfigureActionButtons("Select File", Nothing, Nothing, Nothing)
.InitialBrowseLocation = myInventorFileFolder
.ConfigureFilters("Project Files (*.ipj)", filters, initialFilter)
End With
Dim selEntsResults As Framework.Vault.Forms.Results.SelectEntityResults =
Framework.Vault.Forms.Library.SelectEntity(m_conn, EntSettings)
End Sub