Crystal Reports组名称字段会动态更改. [英] Crystal Reports Group Name Fields Dynamically Change....please.....!

查看:134
本文介绍了Crystal Reports组名称字段会动态更改.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个aspx页面,其中第一页包含dropDownList控件:

I have created two aspx pages where first page contains a dropDownList control :

<asp:DropDownList ID="ddlGroupBy" runat="server" >
                <asp:ListItem Selected="True" Value="Department" Text="Department Wise" />
                <asp:ListItem Value="Grade" Text="Grade Wise" />
                <asp:ListItem Value="Team" Text="Team Wise" />
                <asp:ListItem Value="Category" Text="Category Wise" />
                <asp:ListItem Value="Location" Text="Location Wise" />
            </asp:DropDownList>


还有一个按钮控件,当我单击它时,它会将我重定向到第二页.
第二页具有显示.rpt文件记录的CrystalReportViewerControl.
我还准备了CrystalReport.rpt文件并对其进行了设计.在此文件中,默认情况下,Recoeds将被分组为"Department Wise".但是,如果用户适当更改dropDownControl的项目,我不知道如何更改组名称字段(默认情况下为部门").


And a button control which redirect me to second page wehen I click it.
Second page has CrystalReportViewerControl which displays .rpt files records.
I have also taken a CrystalReport.rpt file and designed it. In this file Recoeds will be grouped by default "Department Wise". But I don’t know how to change the Group Name Fields (which is ‘Department’ by default) if user change the dropDownControl’s items appropriately.

推荐答案

公式字段可基于DropDown选择更改GroupName.

谢谢

You can use Formula Field to change GroupName based on DropDown selection .

Thank You

You Can follow this steps :
1.Save selected value of dropdown in variable 
2.Assgin to Querystring in  Response.Redirect
3.Retrive from Query string in second Page 
4.Assign retrived value to formula field  
5.Finally In Crystal Report ,  Check in If Else and assign value to group name accordingly



在这里,我采取了一个下拉菜单和一个按钮,在单击按钮时,将调用seconf页面.

要在第一页的变量中保存所选值:



Here I have taken One DropDown and Button , on button click , seconf Page will get called.

To Save selected value in variable in first page :

Dim strGroupType As String
strGroupType = ddlInput.SelectedItem.Text.ToString()
Response.Redirect("secondPage.aspx?GroupName=" + strGroupType)



在第二页中,要从QueryString中检索值



In Second Page , To retrive value from QueryString

Dim strGroupName = Request.QueryString("GroupName")



设置在Fornula字段中



To Set in Fornula Field

Dim strFormulas(1) As String '
strFormulas(0) = strGroupName.ToString()
rptViewer.SetFormaulas = strFormulas


终于在Crystal Report中:


Finally In Crystal Report :

If {(strGroupName)= "IT"} Then
        grpName := "IT"
           ElseIf {(strGroupName)= "Purchase"} Then
        grpName := "Purchase"
       Else
        grpName := "Department"  'This is default


这篇关于Crystal Reports组名称字段会动态更改.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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