SearchField
This method searches for a text in a supplier pool and returns the result as field candidates.
Syntax
SearchField(ByVal QueryText As String, pWorkdoc As ISCBCdrWorkdoc, pAnalysisSettings As ISCBCdrAnalysisSettings, ByValFieldName As String)
Parameter | Description |
---|---|
QueryText | The search text. |
pWorkdoc | The current workdoc. |
pAnalysisSettings | Provides access to the Supplier Extraction Engine settings needed to perform a search. |
ByValFieldName | Field name that must exist in the workdoc, incorporates the search results as candidates. |
Sample Code
Sub GeneratePoolData (pworkdoc As SCBCdrPROJLib.SCBCdrWorkdoc)
; Get a handle for the field and settings
; The field in the project file should already be configured for ODBC
Dim oCustomerASSA As SCBCdrField
Dim FieldAnalysissettings As ISCBCdrAnalysisSettings
Dim PoolAnalysisSettings As SCBCdrSupExSettings
Dim SupplierExtractionEngine As New SCBCdrSupplierExtractionEngine
Set oCustomerASSA = pworkdoc.Fields("VendorName")
Project.AllClasses("Invoices").GetFieldAnalysisSettings(oCustomerASSA.Name, "German", FieldAnalysissettings)
Set PoolAnalysisSettings = Project.AllClasses("Invoices").Fields(oCustomerASSA.Name).AnalysisSetting("German")
; Modify the SQL query to set your lookup criteria
PoolAnalysisSettings.SQLQuery = "SELECT * FROM VendorData WHERE Col002 in ('BOLZ', 'Gutman', 'WorldNet')"
; Perform the search
PoolAnalysisSettings.GeneratePoolFromODBC
SupplierExtractionEngine.SearchField("BOLZ Company, Gutman Company, Inc, Worldnet", pworkdoc, FieldAnalysissettings, oCustomerASSA.Name)
; Check if there is at least 1 result
If oCustomerASSA.CandidateCount > 0 Then
;do something
End If
End Sub