Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# grouping / sorting Crystal Reports at runtime

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I am trying to set the grouping / sorting fields at run-time from C#.NET against a Crystal Report.
I'm using the code as provided in the help files using syntax like :
FieldDefinition FieldDef = new FieldDefinition();
FieldDef = Report.Database.Tables[0].Fields["FieldName"];
Report.DataDefinition.Groups[0].ConditionField = FieldDef;

I have the appropriate 'using' set up (for CrystalDecisions.CrystalReports.Engine.FieldDefinition.FieldDefinition()).

When I attempt to compile this code I am presented with a build error suggesting that :
'CrystalDecisions.CrystalReports.Engine.FieldDefinition.FieldDefinition()' is inaccessible due to its protection level'.

I've followed / copied the code sample as suggested within the help files.
Where have I gone wrong / what am I missing ?

Any pointers / help would be appreciated.

Thanks in advance.
Steve
 
I got the same error. But if would compile if I did not make a Field Definition. If I just used one line like:

cr.DataDefinition.Groups[0].ConditionField = cr.Database.Tables[0].Fields[3];
 
I'm now in the same boat as yourself.
However my report I'm making use of does not already have a Group set up - I need to be able to add (and set the Group Field) in one hit ?
Can this be done ?
Thanks again
Steve
 
You cannot add groups on the fly in Crystal Reports 8.5. You can in Crystal Reports 9, but the end user will have to buy a license.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top