Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use CrystalReport 2016 from VFP9.0 2

Status
Not open for further replies.

A Beginner

Programmer
Apr 15, 2017
81
IN
I want to invoke reporting in crystal report from vfp9.0.
Can any body help?
 
Thank You Mike. Your answer has come as source of hope to use crystal report 2016 in vfp9.0. I will go through the document....
 
I read the content on the link. It was last revised on 2006. Vfp has not changed but Crystal Report a lot. So the first and formost question that boggles my mind is 'Is is possible to create report using Crystal Report 2016 from Vfp9.0?' Let us please begin from here.
 
I also went through the link

and tried to run the code mentioned there, 1'st line of which is -
oCRApp = createobject("crystal.crpe.application")
but get the error message "Class definition crystal.crpe.application is not found".
Don't know how to proceed but any how want to implement reporting from Crystal Report on vfp.
 
The 'RDC' and 'ActiveX' are a bit hi-fi terminologies as I have not used them. Please guide me as to how to implement them in this case.
 
You're right. I hadn't realised how old that article was when I posted the link.

When the article was written, the main way of integrating CR with VFP was to use an ActiveX control called the Report Design Component (RDC). That component was certainly available in CR XI, and possibly later, but I haven't used CR recently so I don't know if it is still the tool to use.

Unless anyone else here can answer that question, I suggest you check your CR documentation (if any) or with their support team. Or aks the question here on Tek Tips in one of the Crystal forums. Just ask if the RDC is still available. Don't mention VFP or you will only muddy the water.

If it is availble, then we can guide you in its use. If not, find out what alternatives are now in use (probably .NET, but I don't know that for sure).

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you Mike. This much guideline is more than enough at this point. I will put my query as you have said and return to you as soon as get some positive clue.
 
I can't contribute anything in regard to Crystal Reports. But if even 'ActiveX' is no term to you, that's very basic foundation knowledge you would first have known about as user of Browsers (ActiveX plugins) and also is a thing not only related to VFP, ActiveX controls have a COM (Common Object Model) Interface and can be used in many development environments, so I have to assume you are not only a VFP beginner. Nothing to be ashamed about, everybody starts with little to no knowledge about most anything, but in such very basic and common things, you even find pointers and basic knowledge in Wikipedia.

And in regard of VFP and ActiveX let me point you even one level higher to all possibilities of extending native Foxpro with external libraries:
Notice the terminology here already makes a distinction between ActiveX Controls and Objects, which address visual form control classes and non-visual objects, eg automation server. Crystal would - if it still supports some OLE/COM interface then obviously with changed class names - fall into the latter category.

Bye, Olaf.
 
It might help if you could tell us exactly what you want to achieve.

If you have an existing report, and you simply want to launch it from your VFP application, then you can do that very easily using ShellExecute(). See here for details and examples. And that would also work if you want to generate the data for the report from within VFP.

But if you want to customise the report from within VFP, including changing run-time parameters, then you will need the RDC or its modern equivalent.

If you want to actually create a report from scratch within your application, that's more difficult. As far as I remember, you couldn't do that at all in earlier versions of CR. I don't know whether that would still be true today.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
OK, here's another option. There are several third-party report viewers available that might meet your needs. One that I have used in the past is from a firm called Jeff-Net. It is not free, but is not very expensive. (Actually, there is a free version, but it has limited features.)

The Jeff-Net product has a command-line interface, which means that you can invoke it from VFP with either the RUN command or via ShellExecute(), and you can pass parameters to control its behaviour. It lets you display any existing report (it can't create reports from scratch); you can pass parameters to the report, automatically refresh the report (on a timer), and let the user navigate pages, search, print, export, etc.

Given that you can also create your data source within your VFP app, it would seem that this product could meet most or all of your needs. Thee are other similar tools on the market. I'm not saying that Jeff-Net is necessarily the best, but I know from personal experience that it works.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
In regard to your question about the .NET object model: Well, that's something you can't use directly in VFP, VFP isn't a .NET language. West Wind has a VFP .NET bridge for such things, but it varies, whether you can make use of it or not. I only had good experiences with an assembly (C#) DLL I did myself in the .NET framework version West Winds .NET bridge supports and it mainly also is intended to make use of native .NET framework classes. It adds an extra layer to the Assembly interface, a wrapper/adapter if you want to use that to interface to the .NET interface:
I don't know if that causes too many new work in progress spots at the same time. If you want to make use of Crystal Reports because you have Crystal Report knowledge it may be worth to find such a bridging component. I don't know Jeff-Net and googled it. Turns out it is a Crystal Reports scheduler and viewer, so it offers a bit more than ShellExecuting a report file.

The question is, what kind of interfacing do you really need? Crystal Reports, as far as I know, is a self-contained report designer, reports define their input data and output layout and output file type, if not reporting to printers, don't they? They can read DBFs via ODBC driver and possibly OLEDB provider, so such reports only need to be run from your VFP application, wouldn't they? Everything else could be done within the Crystal Reports application and designers totally independent from VFP. Wouldn't that suffice already?

If you are not familiar with any reporting engine, perhaps you should rather look into MSSQL Reporting Services. VFP can interface with SQL Server easily, most obviously as a remote database, which will become the data source for reporting services. You can start experimenting with the Express version and also have much more than just reporting, it's worth combining any VFP application with MSSQL backend, as that can be a basis for many other technologies capable of using the data from there. Crystal also integrates with MSSQL, for example, so while it's certainly not the main nature of MSSQL, it can bridge VFP and Crystal, too, if I'm not having a totally wrong idea about Crystal.

Bye, Olaf.
 
Thanks a ton.... I had started thinking CrystalReport as inaccessible luscious fruit.
Being a beginner I am not exposed to the knowledge of CR but yes exposed to it's versatility through the videos on
which I had watched in order to be familiar with CR before attempting to use it from VFP.

"...what kind of interfacing do you really need?" I need a self-contained report designer which could design even the complex reports with minimum effort and save time (Which I can also drive from VFP). So, It is only Crystal Report that is wanted.

Your post has opened a lot of possibilities. I will work in directions described in your post and try to make this feasible with whatever effort needed.
 
In that light, as fine as Crystal Report may seem, it might be worth considering something else. In the end, this also goes for VFP itself. You know you work with an end of life product here, no future versions planned and no support and that includes no testing of OS compatibilities and no security patches.

If you begin looking for something else just when hitting the first wall, which also might just turn out to be a solvable hurdle instead or if you move along the wall find a window or even a door, if you always take the least problem as unsolvable without further other better software, you may end up with lots of software claiming to be the best breed and maybe only having enough marketing, which you can't fit together or which makes gluing these components the hardest part of the job.

I handle what I don't get going in an FRX by automating Word or Excel, this also depends very much on the layout. Excel is, of course, best in things needing a column layout, you can easily set a column width, then finally convert to PDF and print. That would be another solution to your previous report layout demand, I still can't know what you really need, though.

It depends whether Crystal or Office is more expensive. From what I googled you can get Crystal Reports 2016 for about 480 USD + tax. Office depends on the edition and licensing model, you might already have it at hand.

All you read about VFP + Crystal as combination mostly only holds true for the older editions, people using such combinations are most often very conservative, also in regard of which VFP version to use. There still is lots of FoxPro legacy FPD FPW version 2.5, 2.6 or 3 around and of course that still integrates with older CR versions. In regard of VFP and CR 2016, I only find threads as your, questions about how to integrate with CR, if at all.

Bye, Olaf.
 
An eye opening post!

Please say how fine it is to use Crystal Report's older versions like 11.5 that supports vfp integration?

One thing I found Layout optimization was easy and good in VFP like centering a report object horizontally with just single click etc which I didn't find in CR even after searching many posts.

I talked to my seniors, What we want to accomplish is as follows, "CR should be integrated with VFP so that
i. It can be distributed with application files,
ii. Edited from within the VFP,
iii. Printed from within VFP.
all this with feeling that report is generated from VFP only."
 
centering a report object horizontally with just single click etc which I didn't find in CR

It's true that you can't do that with a single click in CR, but it's still very simple to align objects horizontally. As you drag the object, you will see a highlight move across the ruler, indicating the object's current position in the page. That makes it easy to judge how to alignment objects, both horizonally and vertically.

But don't judge CR by its inability to centre an object with a single click.

If you are interested in making a point-by-point comparison, you will see that CR has a vast number of features that are not available in VFP, and it allows you to do many things with just a few clicks that would take a lot of work in VFP. One example is its ability to do complex conditional formatting, such as changing the fonts or colours of entire groups of objects based on conditions in the data. Another is the ability to nest one report inside another, which opens up all kinds of possibilities that VFP report developers can only dream of.

Where VFP's report feature scores is in its ability to work directly in the VFP environment, which means easy access to VFP cursors, as well to variables, settings, etc.

Another big weakness of CR is the one you have just discovered. You can't easily integrate it in your VFP application. Whatever method you use, you will have a lot of work to do, and you will not get the "feeling that report is generated from VFP only." If that is important to you, stick with the good old familiar VFP reporting tool.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top