Generate.aspx.vb
Case "costcentersummary"
Dim newparams(4) As ReportParameter
newparams(0) = New ReportParameter("CallClassCode", callClassCode)
newparams(1) = New ReportParameter("DateTimeFrom", startDateTime)
newparams(2) = New ReportParameter("DateTimeTo", endDateTime)
newparams(3) = New ReportParameter("Vat", vat)
newparams(4) = New ReportParameter("CostCenterBy", costcenterby)
rvScreen.LocalReport.SetParameters(newparams)
rvScreen.LocalReport.Refresh()
Dim rdsCostCenterSummary As New ReportDataSource
Dim daCostCenterSummary As New CostCenterSummaryTableAdapter
Dim dtCostCenterSummary As New CostCenterSummaryDataTable
Dim filters = reportFilter.Split(",")
Dim ta As New LCSRDBDataSetTableAdapters.CostCentersLookupTableAdapter
Dim dt = ta.GetData(siteId)
If String.IsNullOrEmpty(reportFilter) Or filters.Count = dt.Rows.Count Then
daCostCenterSummary.SetWhereClause(String.Format("cdr_site_id = '{0}' AND cdr_datetime BETWEEN '{1}' AND '{2}' AND cdr_call_class_code = 'OUTGOING' AND cdr_call_type_id IN({4}) GROUP BY cdr_id", siteId, startDateTime, endDateTime, callClass, callType))
Else
daCostCenterSummary.SetWhereClause(String.Format("cdr_site_id = '{0}' AND cdr_datetime BETWEEN '{1}' AND '{2}' AND cdr_call_class_code = 'OUTGOING' AND cdr_call_type_id IN({4}) AND cost_center_id IN ({5}) GROUP BY cdr_id", siteId, startDateTime, endDateTime, callClass, callType, reportFilter))
End If
daCostCenterSummary.Fill(dtCostCenterSummary)
rdsCostCenterSummary.Name = "LCSRDBDataSet_CostCenterSummary"
rdsCostCenterSummary.Value = dtCostCenterSummary
rvScreen.LocalReport.DataSources.Add(rdsCostCenterSummary)
Standard.aspx.vb(会话)
If (rbCostCenterName.Checked) Then
Session("CostCenterBy") = "name"
ElseIf (rbCostCenterNumber.Checked) Then
Session("CostCenterBy") = "number"
End If
问题:
如何在generate.aspx.vb中嵌套if语句?
或者我应该在standard.aspx.vb中编码吗?
如何从数据集中调用值?
有可能吗?
或者我应该在rdlc报告中编码?
这个想法是:
if(ByCostCenterName is checked) then
CostCenterName is in alphabetical order
if(ByCostCenterNumber is checked) then
CostCenterNumber is in ascending order
end if
end if
答案 0 :(得分:0)
好的,我得到了答案。
在Generate.aspx.vb中,我在那里插入了以下代码。
If costcenterby = "name" Then
daCostCenterSummary.SetWhereClause(String.Format("cdr_site_id = '{0}' AND cdr_datetime BETWEEN '{1}' AND '{2}' AND cdr_call_class_code = 'OUTGOING' AND cdr_call_type_id IN({4}) GROUP BY cdr_id ORDER BY department_description", siteId, startDateTime, endDateTime, callClass, callType))
Else
daCostCenterSummary.SetWhereClause(String.Format("cdr_site_id = '{0}' AND cdr_datetime BETWEEN '{1}' AND '{2}' AND cdr_call_class_code = 'OUTGOING' AND cdr_call_type_id IN({4}) GROUP BY cdr_id ORDER BY cost_center_description", siteId, startDateTime, endDateTime, callClass, callType))
End If