Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

RAS Fields used list

Hi,

I'm using RAS to get the list of the used fields in a Crystal Report for metadata (get the list of green checked fields in CR designer)

The problem is than RAS is missing all fields contained in text objects, and when a sub report exists all main reports fields are missing.

Here my code in C#:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using CrystalDecisions.CrystalReports.TemplateEngine;

using CrystalDecisions.ReportAppServer.ClientDoc;

using CrystalDecisions.ReportAppServer.Controllers;

using CrystalDecisions.ReportAppServer.DataDefModel;

using CrystalDecisions.ReportAppServer.ObjectFactory;

using CrystalDecisions.ReportAppServer.ReportDefModel;

using CrystalDecisions.Enterprise;

namespace WindowsApplication2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

SessionMgr sessionMgr = new SessionMgr();

EnterpriseSession enterpriseSession = sessionMgr.Logon("manager","boss","boxir2sp3","secEnterprise");

EnterpriseService enterpriseService = enterpriseSession.GetService("InfoStore");

InfoStore infoStore = new InfoStore(enterpriseService);

EnterpriseService enterpriseService2 = enterpriseSession.GetService("RASReportFactory");

Object rrfObject = enterpriseService2.Interface;

ReportAppFactory reportAppFactory = (ReportAppFactory)rrfObject;

ReportClientDocument reportclientdocument = reportAppFactory.OpenDocument(17523, 0);

textBox1.Clear();

textBox1.AppendText(reportclientdocument.DisplayName+"\r\n");

// List all fields used in the document

foreach (Field resultField in reportclientdocument.DataDefController.DataDefinition.ResultFields)

{

textBox1.AppendText(resultField.FormulaForm);

textBox1.AppendText("\r\n");

}

}

}

}

Former Member
Not what you were looking for? View more on this topic or Ask a question