如何在Crystal Report上选择下拉列表项? [英] How Do I Select A Drop Down List Item On Crystal Report?

查看:65
本文介绍了如何在Crystal Report上选择下拉列表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页应用中有一个简单的搜索框,我想提供选项在员工表中搜索姓名,员工ID或职位等。即,基本上是一个下拉菜单,然后是一个文本框来输入值。目前正在选择的列来自同一个表。



我假设我需要2个参数等同于两个参考列名称和其他价值。这样对吗?如果是这样,我们如何在公式编辑器上传递sql查询?



我使用了记录选择公式。我写的代码是:



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:

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





其中NAME和POSITION是列名。我已将它们作为下拉列表中的项目手动传递。但该报告给出了一个空洞的结果。 cat是从下拉列表中保存所选值的参数。





我甚至尝试过这样编码:





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:

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





with my c#代码为:



with my c# code being:

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! :(

推荐答案

这篇关于如何在Crystal Report上选择下拉列表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆