Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamically 'Group By' in crystal Reports ( ASP.NET/VS2008)

Posted on 2012-04-09
4
Medium Priority
?
750 Views
Last Modified: 2012-04-11
I have created a group on the crystal report. Code works with one group on the report.

        objRptDoc.DataDefinition.Groups.Item(0).ConditionField = objRptDoc.Database.Tables(0).Fields(rblGroupBy.SelectedValue)
   
Now I added another group on the report and need to dynamically assign the field to the second group. Below code doesnt work with the 2nd group. It just groups by the fields that I assigned during the design time.

objRptDoc.DataDefinition.Groups.Item(1).ConditionField = objRptDoc.Database.Tables(0).Fields(rblSubGroupBy.SelectedValue)    

I'm I missing something.
Appreciate your help!!
0
Comment
Question by:shahjagat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 37824247
Are you sure you are using the new report from the application?

mlmcc
0
 

Author Comment

by:shahjagat
ID: 37824318
I'm not sure when u say 'New Report'.
I just created a report with with 2 groups assigned to two fields at design time.
0
 
LVL 35

Accepted Solution

by:
James0628 earned 2000 total points
ID: 37826344
I don't know anything about running reports from code, but if you can't get the group change to work that way, maybe you could change the report to group on a formula that's controlled by a parameter, and pass different values to the parameter.  Something like this:

// Group by name or city, depending on ?param
if {?param} = "Name" then
  {name field}
else
  {city field}


 James
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 37827243
You indicated this works if there is one group on the report and then yu added a second group.

If you have a standalone report and saved it, the code may still be using the version with 1 parameter rather than the updated version.If you designed this in the VS IDE then you most likely are using the correct version of the  report.

mlmcc
0

Featured Post

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question