I have a single list view and multiple controls to filter that single list.
I have tried proposed solutions in the forums, but mostly are for single drop down list (or using the bilt in filteration which was very complex for the end user).
Can someone please assist as my final solution takes the last filteration and applys it while overriding the previous filter.
Let me understand u more ,
u have multiple controls to filter the list view ?
The best approach i found for this type of request , is to create a SQL stored procedure , then create list view off of that stored procedure .
and u will handle the filteration inside that stored procedure .
lets say u have 3 text boxes for filterations , u will need to have 3 parameters inside the sql stored procedure .
and use these 3 parameters to retrieve the right data .
Hope it helps!
I tried creating a stored procedure like what you advised, but while testing it in SQL Management Server, I received the below error:
Msg 201, Level 16, State 4, Procedure <xxxx>, Line 0
Procedure or function '<xxxx>' expects parameter '@RequestDate', which was not supplied.
It is as if it's asking me to supply all variables, while I require some of the variables and not all.
Also, how can I use the stored procedure in my smartforms?
There is two things to tell you about ,
first , is about how k2 handles sql stored procedure which you will find in the following link , i see its best way to explain it
second , is about sql stored procedures in general .
u will need to know how to create parameters without being "REQUIRED" , im not that expert in sql , but as i remember its all about giving it a default value , the moment u declare it , for ur example the date , just inside ur parameter declaring go for something like
@myDate datetime = '1753-01-01
and inside ur select statement , to make it work either u send the date or not , ur condition will look like following
(if @myDate = tableDate OR @myDate = '1753-01-01')'
in this way it will execute the select statement successfully even if u didnt provide the parameter with a value .
also the thing u might wanna check is having optional parameters in sql or they call it dynamic parameters in search .
Hope it helps!