Quantcast
Channel: SCN: Message List - Java SDK Application Development
Viewing all articles
Browse latest Browse all 2284

How to get tables and fields used in a Crystal Report?

$
0
0

Below is a rudimentary code I wrote to fetch tables and columns in a Crystal Report based on Oracle DB.

 

IInfoObject report = (IInfoObject)boInfoObjects.get(j);  try  {  ReportClientDocument originalDoc = rptAppFactory.openDocument((IInfoObject)boInfoObjects.get(j),0,Locale.ENGLISH);  DatabaseController dbc = originalDoc.getDatabaseController();  IDatabase db = dbc.getDatabase();  Tables tbs = db.getTables();  for(int i=0;i<tbs.size();i++)  {  ITable tb  = tbs.getTable(i);  String tbn = tb.getQualifiedName();  out.println(title+"::"+path+"::"+tbn+" - TableName </br>");  Fields fds = tb.getDataFields();  for(int k=0;k<fds.size();k++)  {  IField fd = fds.getField(k);  out.println("</br>" + k);  out.println("</br>" + fd.getName());  out.println("</br>" + fd.getKind());  out.println("</br>" + fd.getType());  }  }  originalDoc.close();
}

The problem with this code is that it returns all the fields available in the tables in the report. I require only the fields that are actually used in the report.

 

I tried DataDefinition also but couldn't make it work. Fields could be used in any section/object like groups, group headers, formulae etc. If it is used even once anywhere, I need that field name in the form QUALIFIED_TABLE_NAME.FIELD_NAME

 

Basically any DB field that would have that green tick in the Field Explorer.

 

Is there any way to get it?

 

Other Details : BI 4.0 SP9, Crystal Reports 2011

 

Thanks & Regards

Antony


Viewing all articles
Browse latest Browse all 2284

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>