报表参数

目录

1      参数关联加载

2     Code使用

 

1            参数关联加载

输入/选择第一参数时,加载第二个参数。选择第二个参数时,加载第三个参数。效果:

image

数据:

image

第一个参数

类型:string。字符串型,文本框,手动输入。

image

第二参数

类型:string。字符串型,下拉列表,手动选择。

image

数据源:

select distinct title_id  from titles

where pub_id like @pubId + '%'

image

第三参数

类型:string。字符串型,下拉列表,手动选择。

image

数据源:

select type from titles

where title_id=@P_TitleId

运行效果

初始化时:

image

输入第一个参数后:

image

选择第二个参数后:

image

2            Code使用

IIF只能有一个判定条件,多个判定条件时,可以使用Code

例如: 根据条件设置字体颜色。

1 Code,使用工具写代码,并测试以保证无误。

' 国家为USA,字体红色

' 国家为France,字体绿色

' 否则为黑色

Function GetForeColor(byval contry as string) as string

Select contry

case "USA"

return "Red"

 

case "France"

return "Green"

 

else

return "Black"

End Select

End Function

2 嵌入报表中。

报表属性=>代码,然后复制、粘贴。

image

3 使用代码

注意:使用Code调用,红波浪线无影响报表执行。

image

4 运行

image

 

posted @ 2012-02-16 20:07  yellowwood  阅读(316)  评论(0编辑  收藏  举报
Never Give UP