Quantcast
Channel: SCN : Popular Discussions - SAP Crystal Reports, version for Eclipse
Viewing all articles
Browse latest Browse all 893

Set the record selection formula on Crystal Reports using the Java API

$
0
0

I was doing some research on how to set the record selection formula on Crystal Reports using the Java API and noticed that there are 3 methods with which you can do this:

 

1. Using the IFilter interface as shown in this example provided by SAP:

// Set the filter string to be used as the Record Filter

String freeEditingFilter = "{Customer.Country} = 'Canada'";

// Retrieve the record filter for the Data Definition Controller

IFilter iFilter = clientDoc.getDataDefController().getDataDefinition().getRecordFilter();

// Set the filter to free editing text filter string

iFilter.setFreeEditingText(freeEditingFilter);

// Modify the filter through the Record Filter Controller to the report

clientDoc.getDataDefController().getRecordFilterController().modify(iFilter);

 

2. Using the setFormulaText method:

clientDoc.getDataDefController().getRecordFilterController().setFormulaText("{Customer.Country} = 'Canada'");

 

3. Using parameters. Parameters can be passed to the report using code (you can use the addDiscreteParameterValue function in the helper class) or else they can be filled in by the user during runtime

 

I would like to know what the best method to opt for is. From the research carried out so far, I do not believe that using parameters (method 3) is the best option since the parameters cannot be set to optional. Also, I believe that method 1 and method 2 do the same job, however I want to know what the difference between the two methods is?


Viewing all articles
Browse latest Browse all 893

Trending Articles



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