Click here to Skip to main content
15,885,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a simple search box in my web app and i want to provide options of searching the employee table for either name, employee id or position etc. Ie, basically a drop down and then a text box to enter the value. The columns currently being chosen are from the same table.

I have assumed i need 2 parameters equating both such that one refers to the column name and the other to its value. Is it right? And if so, how do we pass the sql query on formula editor?

i have used Record Selection Formula. The code Ive written there is:

C#
if ({?cat}="NAME") 
then {?val}={FATHIMA.NAME} 
else if({?cat}="POSITION") 
then {?val}={FATHIMA.POSITION}


where "NAME" and "POSITION" are column names. I have passed them manually as items in a drop down list. But the report gives an empty result. "cat" is the parameter holding the selected value from the drop down.


I have even tried coding it like this:

C#
if(Length ({?name_sel})>0)
then {?val}={FATHIMA.NAME}
else if(Length ({?pos_sel})>0)
then {?val}={FATHIMA.POSITION}


with my c# code being:
C#
string col = DropDownList1.SelectedItem.Text;
       if(col=="NAME")
       report.SetParameterValue("name_sel", DropDownList1.SelectedItem.Text);
       else
       report.SetParameterValue("pos_sel", DropDownList1.SelectedItem.Text);
         report.SetParameterValue("val", TextBox2.Text);



Please help! :(
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900