在本地模式下设置参数标签 [英] Setting Parameter Labels in Local Mode

查看:82
本文介绍了在本地模式下设置参数标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我创建了一个读取.rdl文件目录的Windows应用程序,允许用户选择一个,然后创建参数表单,将参数传递给RV控件(+数据集yadda,yadda)并以本地模式显示报表。



(VB.Net)



我遇到的问题是这样的 - 一些报告使用具有多个有效值的参数(我可以从硬编码和基于查询的默认值中读取),这在我将所选值重新插入报告之前不会有问题。 / p>


我可以从下拉列表中获取值到报告中OK,但不能终止我弄清楚如何将标签从下拉列表返回到报告中。



报告可以使用参数!MyParameter.Label并在BI Dev环境中通过标签返回OK,那么如何将Label应用于参数????



我的代码到目前为止用于从每个控件中检索值并将其粘贴回参数


(注意: ValueListItem 是包含值和标签的结构。)


(注意: ERHelper.getReportDetail 是一个根据xPath查询从.rdl文件返回值的函数)




Dim rpParam As ReportParameterInfo


Dim rpNewParam 作为 ReportParameter


Dim rl As New List( Of ReportParameter)



For 每个 rpParam In rpTheReport.LocalReport.GetParameters


Dim stParamPath As String = " // def:ReportParameters / def:ReportParameter [@Name ='" & rpParam.Name& "']"


Dim bIsHidden As Boolean =(ERHelper.getReportDetail(rpTheReport.LocalReport.ReportPath,stParamPath& "/ def:隐藏" )= " true" < font size = 2>)


rpNewParam = ReportParameter()


rpNewParam.Name = rpParam.Name



如果 rpParam.ValidValues Nothing ERHelper.getReportDetail(rpTheReport.LocalReport.ReportPath,stParamPath& " / def:ValidValues / def:DataSetReference / def:DataSetName" )<> "" 然后



'组合框


Dim vli As ValueListItem


vli = CType (pnlTable.Controls(rpParam.Name),ComboBox).SelectedItem()


rpNewParam.Values.Add(vli.value)


***需要在此处将标签放入参数中***

Else



'其他控制类型


选择 Case rpParam.DataType


案例 ParameterDataType.Boolean


rpNewParam.Values .Add(IIf(( CType (pnlTable.Controls(rpParam.Name),CheckBox).Checked), " True" " False" ))


案例 Else


rpNewParam.Values.Add(pnlTable.Controls(rpParam。姓名)。文本)


结束 选择


结束 如果


rl.Add(rpNewParam)

Next



rpTheReport.LocalReport.SetParameters(rl)


Me .Close()


解决方案

除此之外:



< p align = left>我已经花了一些时间与你的'对象浏览器',我找不到多值参数列表的标签暴露给开发人员使用的任何地方。



我不想放弃解决这个问题的希望,但我担心我可能不得不尝试不同的方法。



嗯 - 报告定义中有自定义函数的东西从数据集中获取值? Eww!



帮助!!!


 

I've created a windows app that reads in a directory of .rdl files, allows the user to select one, then creates a parameter form, passes the parameters to a RV control (+ datasets yadda, yadda) and displays the report in local mode.

 

(VB.Net)

 

The problem I have is this - Some of the reports use parameters with multi Valid Values (which I can read both from hard-coded and query based defaults), which is not a problem until I go to re-insert the selected value back into the report.

 

I can get the value from the drop down list into the report OK, but can't for the life of me figure out how to get the Label from the drop down back into the report.

 

The report can use Parameters!MyParameter.Label and in the BI Dev environment it passed labels back OK, so how do I apply the Label to the parameter ????

 

My code so far for retrieving the values from each control and sticking it back into the parameter

(Note: ValueListItem is a structure containing a value and a label.)

(Note: ERHelper.getReportDetail is a function that returns a value from the .rdl file based on an xPath query)

 

 

Dim rpParam As ReportParameterInfo

Dim rpNewParam As ReportParameter

Dim rl As New List(Of ReportParameter)

 

For Each rpParam In rpTheReport.LocalReport.GetParameters

Dim stParamPath As String = "//def:ReportParameters/def:ReportParameter[@Name='" & rpParam.Name & "']"

Dim bIsHidden As Boolean = (ERHelper.getReportDetail(rpTheReport.LocalReport.ReportPath, stParamPath & "/def:Hidden") = "true")

rpNewParam = New ReportParameter()

rpNewParam.Name = rpParam.Name

 

If (Not rpParam.ValidValues Is Nothing) Or ERHelper.getReportDetail(rpTheReport.LocalReport.ReportPath, stParamPath & "/def:ValidValues/def: DataSetReference/def: DataSetName") <> "" Then

'Combo Box

Dim vli As ValueListItem

vli = CType(pnlTable.Controls(rpParam.Name), ComboBox).SelectedItem()

rpNewParam.Values.Add(vli.value)

*** NEED SOMETHING HERE TO PUT THE LABEL IN THE PARAMETER ***

Else

'Other Control Type

Select Case rpParam.DataType

Case ParameterDataType.Boolean

rpNewParam.Values.Add(IIf((CType(pnlTable.Controls(rpParam.Name), CheckBox).Checked), "True", "False"))

Case Else

rpNewParam.Values.Add(pnlTable.Controls(rpParam.Name).Text)

End Select

End If

rl.Add(rpNewParam)

Next

rpTheReport.LocalReport.SetParameters(rl)

 

Me.Close()

 

解决方案

Further to this:

 

I've been spending some time with ye olde' Object Browser and I cannot find anywhere where the labels of a multi value parameter list is exposed for developer use.

 

I don't want to give up hope of solving this, but I fear that I might have to, and try a different approach.

 

Hmmm - something with a custom function in the report definition to resolve a value from a dataset?  Eww!

 

Help!!! 


这篇关于在本地模式下设置参数标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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