SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a dynamic query filter with N columns but to do this I must store the entire query in a parameter.

Assuming $myParam = "@Title"

      ' Select="Rows/@Title" ' !=  'Select="Rows/$myParam" '

Eventually the goal is to have

$myParam= "starts-with(@Title,'s')"


How can I reference a field in a parameter properly?

If this is not possible is there a way I could extract substrings and things like that within my xsl code?

share|improve this question
up vote 0 down vote accepted

This could not be done, but I did manage to create a work around where I added select parameters to my SqlDataSource connection. Which allowed me to use DVWP QueryString parameters in a where clause

 <SharePoint:SPSqlDataSource ... SelectCommand="SELECT * FROM myTable WHERE col1 LIKE myParam"  />
           <WebPartPages:DataFormParameter Name="myParam" ParameterKey="myParam" PropertyName="ParameterValues" DefaultValue="%%" />

I Defaulted all columns to a wild card that matched all values using the LIKE clause and had a variable set for every column in the table. Since I moved the wildcards to be within my parameter value I could replicate other query types like so..

all: '%%'

contains: '%myValue%'

starts-with : 'myvalue%'

ends-with: '%myvalue'

is-equal-to: 'myvalue'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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