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?

1 Answer 1


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'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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