Skip to Content
author's profile photo Former Member
Former Member

Group Headers Missing in Report

Post Author: CHTClay

CA Forum: .NET

Ok, this is driving me full goose bozo. Using RAS SDK I can add grouping to my reports all day long, however, when I run the report the group header is blank. The groups show up in the group tree, just no text in the group field. Here is the code I use to group:

private void AddGroup(ISCDReportClientDocument oDoc, string TableName, string FieldName)

{

CrystalDecisions.ReportAppServer.DataDefModel.Group oGroup;

CrystalDecisions.ReportAppServer.DataDefModel.Table oTable;

ISCRTable oISCRTable;

Field oField;

oGroup = new CrystalDecisions.ReportAppServer.DataDefModel.GroupClass();

oISCRTable = oDoc.Database.Tables.FindTableByAlias(TableName);

oTable = ((CrystalDecisions.ReportAppServer.DataDefModel.Table)oISCRTable);

oField = ((Field)oTable.DataFields.FindField(FieldName, CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleUserDefault));

oGroup.ConditionField = oField;

oDoc.DataDefController.GroupController.Add(-1, oGroup);

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 09:41 PM

    Post Author: Ted Ueda

    CA Forum: .NET

    You'll actually have to create a FieldObject and place it in the GroupHeaderSection.Sincerely,Ted Ueda

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 09:49 AM

    Post Author: CHTClay

    CA Forum: .NET

    Ted,

    Thanks very much for your reply. I tried adding a Field object, which does show up, but, sad to say, I have no idea how to get the value of the group header into it. Any suggestions?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 22, 2008 at 10:07 PM

    Post Author: CHTClay

    CA Forum: .NET

    The Solution. Added the code that is bold and italic:

    CrystalDecisions.ReportAppServer.ReportDefModel.ReportDefinition oRepDef;

    CrystalDecisions.ReportAppServer.ReportDefModel.Section oSec2;

    CrystalDecisions.ReportAppServer.DataDefModel.Group oGroup;

    CrystalDecisions.ReportAppServer.DataDefModel.Table oTable;

    ISCRTable oISCRTable;

    Field oField;

    CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject oFieldObject;

    oRepDef = new CrystalDecisions.ReportAppServer.ReportDefModel.ReportDefinitionClass();

    oSec2 = new CrystalDecisions.ReportAppServer.ReportDefModel.SectionClass();

    oGroup = new CrystalDecisions.ReportAppServer.DataDefModel.GroupClass();

    oFieldObject = new FieldObjectClass();

    oISCRTable = oDoc.Database.Tables.FindTableByAlias(TableName);

    oTable = ((CrystalDecisions.ReportAppServer.DataDefModel.Table)oISCRTable);

    oField = ((Field)oTable.DataFields.FindField(FieldName, CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleUserDefault));

    oGroup.ConditionField = oField;

    oDoc.DataDefController.GroupController.Add(-1, oGroup);

    oRepDef = oDoc.ReportDefinition;

    oSec2 = oRepDef.get_GroupHeaderArea(ha).Sections[0];

    oFieldObject.Kind = CrReportObjectKindEnum.crReportObjectKindField;

    oFieldObject.FieldValueType = oField.Type;

    oFieldObject.DataSource = oField.FormulaForm;

    if (oField.Type == CrFieldValueTypeEnum.crFieldValueTypeDateTimeField)

    oFieldObject.FieldFormat.DateTimeFormat.DateTimeOrder = CrDateTimeOrderEnum.crDateTimeOrderDateOnly;

    if (oField.Type == CrFieldValueTypeEnum.crFieldValueTypeInt32sField)

    oFieldObject.Format.HorizontalAlignment = CrAlignmentEnum.crAlignmentLeft;

    oDoc.ReportDefController.ReportObjectController.Add(oFieldObject, oSec2, 0);

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.