1

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?

Mike
  • 12,186
  • 8
  • 41
  • 64
user13186
  • 886
  • 1
  • 16
  • 34

1 Answers1

0

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'

user13186
  • 886
  • 1
  • 16
  • 34