Skip to Content

Determining if a field/formula will participate in an export

VS 2010, CR 2011, winform application.

After previewing a report in a viewer application, is there a way to use code to determine which main report fields/formulas would participate in an export?

Or is there a way to identify which main report fields/formulas are currently visible on the main report layout, or currently hidden but may become visible through drill-down?

Thanks,

- Ido

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Dec 09, 2011 at 01:36 PM

    Hi Ido,

    With the following code you should be able to find all the fields on the main reports

    private void FindReportObects(ReportDocument reportDocument)
        {
            if (reportDocument.ReportDefinition.ReportObjects.Count > 0)
            {
    
                Response.Write("<table border=1 cellspacing=2>");
                Response.Write("<tr>");
                Response.Write("<td><b>Report Object Name</b></td>");
                Response.Write("<td><b>Report Kind</b></td>");
                Response.Write("<td><b>Report Object Format</b></td>");
                Response.Write("</tr>");
    
                foreach (ReportObject reportObject in reportDocument.ReportDefinition.ReportObjects)
                {
                    Response.Write("<tr>");
                    Response.Write("<td>" + reportObject.Name + " </td>");
                    Response.Write("<td>" + reportObject.Kind.ToString() + " </td>");
                    Response.Write("<td>" + reportObject.ObjectFormat.ToString() + " </td>");
                    Response.Write("</tr>");
                }
    
                Response.Write("</table>");
            }
    
        }

    With drilldown you should be able to find the GroupName, ObjectName, GroupPath, and DataContext.

    You can use DrillDownEventArgs class for above.

    For more you can use [Crystal Reports .NET SDK API Reference|http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_apiRef_12_en.chm]

    Hope that helps

    Thanks,

    Saurabh

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Ido,

      My code checks both the conditions if you notice it.

      for section I have

      Section section = sections<i>;
      if (!section.SectionFormat.EnableSuppress)
                         {
      --------
      -----             }

      and for field/formula present in it I have updated the code.

      foreach (ReportObject reportObject in rptObjects)
                                 {
                                     if (!reportObject.ObjectFormat.EnableSuppress)
                                     {
      -----
      ----
            }
      }

      I will check if I can find any direct approach, but I could think of this only.

      Thanks

      Saurabh

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.