I am to use SharePoint Designer, no custom c# code.

I am currently using a SharePoint:SPDataSource on a DVWP to show a list. When the SelectCommand is blank, it works fine but I will need to create dynamic filter.

Working Data Source:

 <SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="" UseInternalName="True" UseServerDataFormat="True" ID="spdatasource2">

I have a choice field, myField which is either 'Public' or 'Private', currently I am only looking to find items with 'Public'. I have tried:

 SelectCommand="<View><Query><Where><Eq><FieldRef Name='myField'/><Value Type='Text'>Public</Value></Eq></Where></Query></View>"

Errors: One or more field types are not installed properly


 Selectcommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;myField&quot;/&gt;&lt;Value Type=&quot;Text&quot;&gt;Public&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;"

Errors: Cannot Complete this action

Eventually I am looking to build an equivalent of

 SelectCommand  = "Select * From myList Where myField like '"+@selectParam1+"'"
  <SelectParameter ID='selectParam1' DefaultValue="*" Location="QueryString"/>

I have also tried to use ajax on the address:


This always downloads a file of the default view instead of show xml causing the POST request to fail.

Another attempt was to use xsltListViewWebPart but I could not get a valid query in that either.



Change <Value Type='Text'> to <Value Type='Choice'> in the SelectCommand CAML query

See MSDN - SPFieldType Enumeration for the different values you can use for each field type.

  • Can you explain why this should work? Since we don't even know the field type of the custom field Oct 2 '13 at 11:56
  • @Robert the op has stated "I have a choice field, myField which is either 'Public' or 'Private'" Oct 2 '13 at 12:28
  • True, I missed that, sorry! But I still see no good cause to use Choice instead of Text as Value Type, do you have a good source for that statement? Oct 2 '13 at 12:44
  • @Robert quiet right I should have provided that! I've updated my answer to include a reference for the different values. Oct 2 '13 at 14:06
  • Great, but these are FieldTypes, not the value types that SharePoint actually stores. Have you tried your solution? (Asking out of curiosity, since I find this interesting) Oct 2 '13 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.