on 05-20-2011 6:07 AM
I am trying to read data values from a saved crystal report. (groovy code snippet below)
I open a new ReportClientDocument and set the RAS using the inprocConnectionString property.
Then I get the rowsetController and set defaultNumOfBrowsingRecords, rowsetBatchSize and maxNumOfRecords all to 1000000
Using the browseFieldValues method after that returns only 100 records. I want to get all.
ReportClientDocument clientDocSaved;
def pathout=rc.pathToSavedReports+rr.path;
//****** BEGIN OPEN SAVED SNAPSHOT ************
clientDocSaved = new ReportClientDocument();
clientDocSaved.setReportAppServer(ReportClientDocument.inprocConnectionString);
// Open report
println("Reading file in.")
clientDocSaved.open(pathout, OpenReportOptions._openAsReadOnly);
def rowsetController = clientDocSaved.getRowsetController()
rowsetController.setDefaultNumOfBrowsingRecords(1000000)
rowsetController.setRowsetBatchSize(1000000)
rowsetController.setMaxNumOfRecords(1000000)
//setup metadata
IRowsetMetaData rowsetMetaData = new RowsetMetaData()
Fields fields = clientDocSaved.getDataDefController().getDataDefinition().getResultFields()
rowsetMetaData.setDataFields(fields)
def values = rowsetController.browseFieldValues(fields.get(0), 1000000)
values.each{value->
println(value.displayText(new Locale("ENGLISH")))
}
Before using the browseFieldValues method I was trying to use a rowsetCursor
//get the rowset cursor to navigate through the results
RowsetCursor rowsetCursor = clientDoc.getRowsetController().createCursor(null, rowsetMetaData)
//navigate through the rowset and log the name and value
rowsetCursor.moveTo(0)
while(!rowsetCursor.isEOF()){
Record currentRecord = rowsetCursor.getCurrentRecord()
//println("current record number: " + rowsetCursor.getCurrentRecordNumber())
for(int i=0;i<fields.size();i++){
//println("Column - "+fields.get(i).getName())
if (currentRecord.size()>0){
println(currentRecord.getValue(i))
}
}
rowsetCursor.moveNext()
}
the currentRecord was always an empty list and I did not get any data values at all.
Am I missing something in using these approaches?
I'm fairly new to using the Java SDK for CR. Any help will be greatly appreciated.
Thanks
hi, I am trying this second method to read the values from report. but all the records comming as null. Kindly help me to resolve this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.