Friday, March 9, 2012

How to create a cystal report based on a text-based data file?

I am a beginner to use cystal report. I wonder if i could establish a report based on a text data file?

for example:

test report 9/20/2004

X Y
--
1 1
2 2
3 3
. .
. .
. .
. .

i'd like to create a graph in my test report. (X axis and Y axis array is based on the above data)

How can i do that? Thanks!

KevinYou can create your report using CDO (Crysal Data Objects). CDO is Crystal's version of a recordset. Basically, you populate a variant array with your data (that you pulled from the text file), then stuff the array into the CDO rowset and pass the CDO Rowset to Crystal.

To get a better explanation and some code examples, do a search for CDO on this forum. I've posted many times with code examples.

As for the Graph, you can click Insert, Chart and follow the instructions from there.

(All of my suggestions and code examples are for vb 6 and CR 8.5 using RDC.)|||As my study, one cystal report has to be set in one path location, right? Because i want to generate a test report for each user specified test record data, the test data is in different location.

So is that possible i can tell cystal report where to find the test data and then generate a report?

Thanks any way!

Kevin|||Using CDO (in the way that I described) gives VB all the control of gathering the data. The only thing Crystal Reports does is display the data that VB passes it. In my opinion, it gives you (as the developer) more control. It's better for error trapping (since you can step through the code and see exactly what is being passed to Crystal).

Try this link:
http://www.dev-archive.com/forum/showthread.php?s=&threadid=281658&highlight=cdo|||thanks a lot!

One more help, i wonder if i could also gerenate the pdf file based on my test data. Do you have any idea on which some control i can use for pdf?

Thanks!

Kevin|||Crystal Reports has it's own built-in Export function. You can export to pdf and several other formats. I can give you code that will work with CR 8.5 using RDC and VB 6 if tha will help you. Otherwise, do a search either on this forum or on the following links:

Crystal Reports Support:
http://support.businessobjects.com/search/advsearch.asp

Crystal Reports Forum:
http://support.businessobjects.com/forums/default.asp|||if you could provide me the sample, that will be great!

Thanks a lot! :)

Kevin|||This example uses CR 8.5 and RDC to export a report to pdf.

Report.ExportOptions.DestinationType = crEDTDiskFile
Report.ExportOptions.FormatType = crEFTPortableDocFormat
Report.ExportOptions.PDFExportAllPages = True

Report.ExportOptions.DiskFileName = strFilePath

'Export to PDF Format, setting False prevents the Export dialog window from showing
Report.Export False|||but how can i let chart draw a curve base on the arrays data, one array is for X-axis, the other is for Y-axis?

Thanks!

Kevin|||I don't how to do charts in Crystal (haven't had to use them yet), but you should be able to click Insert, Chart and follow the directions. Using Groups and Crosstabs has been fairly simple so far, maybe charts will be too?

No comments:

Post a Comment