|
Home > Archive > Microsoft Content Management Server > July 2007 > Search by Custom Types
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Search by Custom Types
|
|
| Achuss AKA JapiJavi 2007-07-12, 7:16 am |
| Hi all!
I've got a MultiColumn Custom Type Field and I'm trying to search for
items inside the list it's contained.
Basicaly, my multicolumn field holds two columns: one for Category and
another one for Capabilities (similiar to the Country/City relations).
For example, I have stored: Usa as country and LA, Chicago and New
York as cities.
Now, I'm coding a search page using the SPList object, GetItems
method, passing as a parameter the query inside a SPQuery object:
SPQuery spQuery;
SPListItemCollection spQueryResults;
SPList myTestList = myTestWeb.Lists["Agencies"];
string agencyQuery = "<Where><Contains><FieldRef Name='Cat-
Cap1'/><Value Type='Text'>Design</Value></Contains></Where>";
spQuery = new SPQuery();
spQuery.Query = agencyQuery;
spQueryResults = myTestList.GetItems(spQuery);
"Cat-Cap1' is the name of the column I added of type
"CategoryCapability" type.
"CategoryCapability" is the Custom Type control I created.
Performing this query I don't get any error, the error is raised when
trying to access the results. This is the message:
{"One or more field types are not installed properly. Go to the list
settings page to delete these fields."}
| |
| Achuss AKA JapiJavi 2007-07-12, 7:16 am |
| On 12 jul, 12:36, Achuss AKA JapiJavi <ach...@gmail.com> wrote:
> Hi all!
> I've got a MultiColumn Custom Type Field and I'm trying to search for
> items inside the list it's contained.
> Basicaly, my multicolumn field holds two columns: one for Category and
> another one for Capabilities (similiar to the Country/City relations).
> For example, I have stored: Usa as country and LA, Chicago and New
> York as cities.
>
> Now, I'm coding a search page using the SPList object, GetItems
> method, passing as a parameter the query inside a SPQuery object:
>
> SPQuery spQuery;
> SPListItemCollection spQueryResults;
> SPList myTestList = myTestWeb.Lists["Agencies"];
>
> string agencyQuery = "<Where><Contains><FieldRef Name='Cat-
> Cap1'/><Value Type='Text'>Design</Value></Contains></Where>";
>
> spQuery = new SPQuery();
> spQuery.Query = agencyQuery;
> spQueryResults = myTestList.GetItems(spQuery);
>
> "Cat-Cap1' is the name of the column I added of type
> "CategoryCapability" type.
> "CategoryCapability" is the Custom Type control I created.
>
> Performing this query I don't get any error, the error is raised when
> trying to access the results. This is the message:
> {"One or more field types are not installed properly. Go to the list
> settings page to delete these fields."}
Hi all again!
I've already solved my problem.
My problem was the configuration of the XML tag with the type of the
field.
This is the solution:
<Where><Contains><FieldRef Name='Cat_x002d_Cap1'/><Value
Type='CategoryCapability'>Design</Value></Contains></Where>
I had 2 problems:
I had to translate Cat-Cap1 into Cat_x002d_Cap1 (more XML friendly :P)
I had to place the correct type of the field. Instead of "Text" I've
placed 'CategoryCapability'
|
|
|
|
|