on 06-08-2006 8:03 PM
Hi,
I'm using the MDM COM API and I have the following issue:
I want to make a search on the Products table based in the following conditions:
All Products which "Description" has the keyword = "Car" and Material Group = "2"
I have found that the following can narrow the search but only with one field at a time, but can't find how to make the quey with both fields (Material Group and Description):
rsd.Table = "Products"
rsd.Fields.Append("Material Number")
rsd.Fields.Append("Description")
rsd.Fields.Append("Material Type")
rsd.Fields.Append("Material Group")
rsd.Fields.Append("Base Unit")
searchTable = "Products"
displayField = "Description"
displayField2 = "Material Type"
searchString = "Car"
searchString2 = "2"
s.SearchTable = rsd.Table
s.Parameters.NewFreeFormParameter(searchTable).Fields.New(displayField).FreeForm.NewString(searchString, FreeFormSearchTypeEnum.xcPrefixSearchType)
's.Parameters.NewFreeFormParameter(searchTable).Fields.New(displayField2).FreeForm.NewString(searchString2, FreeFormSearchTypeEnum.xcEqualToSearchType)
' s.Parameters.NewLookupParameter()
rs = Catalogo.GetResultSet(s, rsd, "Material Number", True, 0)
Any advice is welcome
Hi Elias,
See the following <a href="/people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api which describes how to perform free-form searches via the Java API. The COM API works almost identically, so you should have no trouble implementing it in COM.
Walter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elias,
add the following line
search.SearchType() = SearchCombinationTypeEnum.xcGlobalAndSearchCombinationType
Hope this helps,
Richard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elias,
You must uncomment the second statement shown below so that both parameters are added to the search. And by adding the line of code i gave you previously, the code will search for records having both search criteria.
s.Parameters.NewFreeFormParameter(searchTable).Fields.New(displayField).FreeForm.NewString(searchString, FreeFormSearchTypeEnum.xcPrefixSearchType)
's.Parameters.NewFreeFormParameter(searchTable).Fields.New(displayField2).FreeForm.NewString(searchString2, FreeFormSearchTypeEnum.xcEqualToSearchType)
Richard,
When the debuger gets to the second line:
s.Parameters.NewFreeFormParameter(searchTable).Fields.New(displayField2).FreeForm.NewString(searchString2, FreeFormSearchTypeEnum.xcEqualToSearchType)
The following error occurs:
An unhandled exception of type 'System.ArgumentException' occurred in MDM COM 1.exe
Additional information: The parameter is incorrect.
Any idea?
Hi Elias,
This is some vb code that worked for me. I call NewFreeFormParameter only once.
Dim ffParam As FreeFormTableParameter = search.Parameters.NewFreeFormParameter(Table)
ffParam.Fields.New(Field1).FreeForm.NewString(searchString1, FreeFormSearchTypeEnum.xcEqualToSearchType)
ffParam.Fields.New(Field2).FreeForm.NewString(searchString2, FreeFormSearchTypeEnum.xcSubstringSearchType)
Let me know if this works.
Richard
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.