Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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')"

Select="Rows[$myParam]"

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

1 Answer 1

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"  />
      <SelectParameters>
           <WebPartPages:DataFormParameter Name="myParam" ParameterKey="myParam" PropertyName="ParameterValues" DefaultValue="%%" />
  </SelectParameters>
  </SharePoint:SqlDataSource>

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

 
discard

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.