This question is locked. New answers and comments are not allowed.
Hi,
I'm new to both OA and Linq so don't know if the following is possible, but would be great to find a way.
I have a query form with 12 fields the user can enter filter values for. When they submit the form the filter values are passed to another page as part of the querystring, e.g:
I would like to build a Linq query based on these filter values, however I don't know which fields the user is going to use for their filter.
Currently I am using OA and Linq to query my datasource:
I know I can add Where clauses to the query like so (assuming the field being queried is 'Project' and I've put the querystring value into a variable called a_project :
But that only works when I know the user is filtering on the Project field. I could build a huge number of Ifs and adjust the query in each one, but this seems very in-elegant.
Any suggestions?
Thanks,
Neil.
I'm new to both OA and Linq so don't know if the following is possible, but would be great to find a way.
I have a query form with 12 fields the user can enter filter values for. When they submit the form the filter values are passed to another page as part of the querystring, e.g:
search.aspx?project=abc123&office=xyz |
I would like to build a Linq query based on these filter values, however I don't know which fields the user is going to use for their filter.
Currently I am using OA and Linq to query my datasource:
Using context as JobTrackerEntityDiagrams = New JobTrackerEntityDiagrams |
Dim proj = From c In Context.Projects _ |
Select c |
End Using |
proj = proj.Where(Function(p) p.Project.Contains(a_project)) |
Any suggestions?
Thanks,
Neil.