INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to use CrystalReport 2016 from VFP9.0

How to use CrystalReport 2016 from VFP9.0

(OP)
I want to invoke reporting in crystal report from vfp9.0.
Can any body help?

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
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....

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
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.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
I also went through the link
http://www.tek-tips.com/faqs.cfm?fid=306

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.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
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.

RE: How to use CrystalReport 2016 from VFP9.0

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

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
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.

RE: How to use CrystalReport 2016 from VFP9.0

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: https://msdn.microsoft.com/en-us/library/aa975601(...

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.



RE: How to use CrystalReport 2016 from VFP9.0

(OP)
Thank you Olaf for guiding this peculiar beginner.

RE: How to use CrystalReport 2016 from VFP9.0

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

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
Thank you Mike for ShellExecute() excellent documentation.

RE: How to use CrystalReport 2016 from VFP9.0

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

RE: How to use CrystalReport 2016 from VFP9.0

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: https://west-wind.com/wwdotnetbridge.aspx

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.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
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
http://www.mozoget.com/download-lynda-crystal-repo...
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.

RE: How to use CrystalReport 2016 from VFP9.0

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.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
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."

RE: How to use CrystalReport 2016 from VFP9.0

Quote:

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

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
I agree.
Is there also issue with stretch with overflow there? The 'Can Grow checkbox' is not fixing it in my case.
There some registry setting is required as I found on
https://archive.sap.com/discussions/thread/3446761
Registry setting is a dreadful thing isn't it?
This post is a bit out of track though, please ignore it if it is more than it should be..

RE: How to use CrystalReport 2016 from VFP9.0

Regarding that thread setting the CanGrow option and limiting the number of rows to 1 fixes the posters issue of text flowing into further columns, so it causes clipping instead of growing. Setting MaxRows higher would cause multiple rows. But also no growth in the horizontal direction, not let the width grow. No one says the registry settings are necessary.

I don't know Crystal, as said, but take your look around further options. If there is a CanGrow option, there may be a way to define the direction of growth, it is logical the natural growth direction is where you can grow "infinitely", as I already explained in your other post.

This is what I found in another discussion: https://stackoverflow.com/questions/4182526/crysta...

So also Crystal does not offer the option of automatic column width growth.

Bye, Olaf.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
"...it causes clipping instead of growing." I had tested this. "Can't it grow in vertical direction only pushing the next row that many lines away as many lines it has grown." was my question.
However, very much thankful to you that you have made searching for me.

RE: How to use CrystalReport 2016 from VFP9.0

Are you sure you are not confusing the meaning of horizontal and vertical growth?

In thread184-1777416: Can a field object in VFP Report writer be resized automatically? you said

Quote (A Beginner)

I want to resize object's width
Dynamically changing the width of a column means horizontal growth.

Vertical growth just means multiline text wrapping on a column having a fixed width and is what VFP reports also offer as standard behavior.

Bye, Olaf.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
Ok.
"Is there also issue with stretch with overflow there? The 'Can Grow checkbox' is not fixing it in my case."
Seems that '...my case' in my last comment is redirecting you to my previous post that was about making a generalized frx for Askingrid.
That issue was fixed by hacking frx.
Here with '... my case' I meant I was testing Stretch with overflow in case of crystal report and I found that it was either clipping the content or overlapping with next line.
whereas in vfp the next row is pushed to next line.
I couldn't do this with my efforts in crystal report so, I was confirming that is it a bug here?
I am Sorry about my way of communication.

RE: How to use CrystalReport 2016 from VFP9.0

Hello.

Maybe I can had some clarification. I’m still using Crystal report 2016 with my VFP 9 applications for reporting VFP or SQL Server data.

The RDC was included with Crystal Report until XI Rel2. After that, Crystal Decision decide to discontinue the RDC ActiveX objects for Crystal.

The route Crystal (and now SAP) is to concentrate on .NET technologies.

I think you can download RDC components (Crystal XI R2 SP6) merge modules from the SAP web site (https://smpdl.sap-ag.de/~sapidp/012002523100000634...) and install it on your dev. or client machine.

You must create your report with a legit version of Crystal report, or, if you prefer, get a free version of Visual Studio .NET Express (MS), and a free version of Crystal for .NET (SAP). The .NET version of Crystal has the built in report designer so you can create your report in .NET, save it and include it in the VFP application.

I hope it helps a little.

Thanks

Nro

RE: How to use CrystalReport 2016 from VFP9.0

I can't help you with Crystal in that matter. I don't have it and never used it. All I could do is search for forum posts about your issue, but you can do that, too.

From the discussion, which I already found, you could have already learned that you can indeed set a number of lines to grow, 0 for infinite lines and a concrete number for limiting the line breaks. I don't know what else this causes in terms of overflowing into other text or clipping the "cell". All I can conclude from the Crystal Report question I found is, that such things are also not so easy with Crystal.

Bye, Olaf.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
Thanks Olaf for your painstaking guidance.
It is true that many things are not so easy with Crystal but at the same time it is also true many other features and options are wide open here. So before deciding to purchase, willing to do all sort of r&d on it to the extent possible.

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
Welcome NRO, Your sudden appearance with hand-on experience on the things is delightful.
As of now We only have-
1. Crystal Report 2016 (Trial version) and
2. VFP9.0
Please provide us step by step guidance.
* What all things are required If we want to generate the report from vfp itself?
* How to do reporting from crystal report utilizing the cursors and other data sources of vfp?
* How to include CR's report in Vfp applications.
Thank you

RE: How to use CrystalReport 2016 from VFP9.0

I can answer some stuff from the perspective of the VFP expert:
You can't share cursors with any DLL or OCX, these are always external processes not able to access VFP internals like data sessions and cursors.
Also, FRXes are their own league, you don't integrate a "Crystal Control" or something of that kind into an FRX, Crystal Reports are standalone.
VFP has no linker whatsoever, so you can't combine any lib with your other code and create a single EXE containing third party library. This goes for any library and OLE or COM component. VFP is itself made with C++, but it has not inherited the compiling capabilities of C++. VFP only ever does so-called late binding of DLLs and OLE classes, which also limits some use of libraries meant for early binding. In regard of compiling, building a setup and redistribution this means any third party tools remain separate DLLs etc. you ship separately from your EXE and the VFP runtime DLLs. Even the VFP runtime DLL itself is something staying a standalone file external to your VFP EXE.

So overall, and this is where someone with experience on how you make use of Crystal Reports may chime in, overall you can only run a Crystal Report, you can't embed it into your EXE. Crystal has it's own data access layer and can most probably like any special standalone report engine access most any database offering am ODBC interface or OLEDB, so your data preparation will be in Crystal, not in VFP. The automation of Crystal might go further than that, but why don't you refer to manuals and help of your trial version. You can't assume I do so for you just because I know my way around VFP better.

Further things are shallow knowledge and assumptions:
As far as I know, Crystal Reports can be stored in RPT files, which is the equivalent of FRX. As they don't belong to the files the VFP runtime can directly cope with, they surely would go separately from a VFP EXE.

You should perhaps take a look at the Install Shield Express Software coming with VFP9 to create Setups, this is not a process you do from within the VFP IDE, this is a "post production" step after building an EXE, you bundle your EXE, runtimes, further DLLs etc into a Setup. Since this is not concerned with the VFP language, you can create setups with any such tool. You also find a lot of info on the free and yet more feature rich Inno Setup in the fox.wikis.com. Such search Inno in the Wiki search on the right-hand side of the header.

Bye, Olaf.

RE: How to use CrystalReport 2016 from VFP9.0

1 – You can’t create a Crystal document inside VFP IDE. Crystal is a stand-alone product and you always create the report (.RPT) within Crystal IDE. Your report connect to a data source, can have parameters etc.
We use Crystal 2008 (V.12) but I think it’s also working CR 2016 (V14).

2 – To be able to manipulate Crystal into VFP, you must register Crystal Report runtimes. I think the easiest way is to create an InstallShield installer with the Crystal Merge modules and run it on your development machine (and client machine as well). The merges modules are royalty free.

3 – There are a lot of tips on forums for accessing PEM of a Crystal object.
Here is a small example of changing data connection and exporting the report in PDF format.

CODE

#DEFINE crOpenReportByDefault 0
#DEFINE crOpenReportByTempCopy 1

#DEFINE crEFTPortableDocFormat 31
#DEFINE crEDTDiskFile 1

DIMENSION laTbl[2,2]
laTbl[1,1] = "\\EVOD500\Data_F\Apps\Develop\DbfTeck\cus_mai1.dbf"
laTbl[1,2] = "cus_mai1"

laTbl[2,1] = "\\EVOD500\Data_F\Apps\Develop\DbfTeck\fac_hd01.dbf"
laTbl[2,2] = "fac_hd01"

lcRDC = "CrystalRuntime.Application.11"
loCrystalReport = CREATEOBJECT(lcRDC)

tcReport = "C:\temp\report1.RPT"

loRet = loCrystalReport.OpenReport(tcReport, crOpenReportByDefault)

lnTableCount = loRet.Database.Tables.Count
FOR lnMi = 1 TO lnTableCount 
 lcTable = loRet.Database.Tables(lnMi).Location
 lnScan = ASCAN(laTbl, lcTable, 1, ALEN(laTbl,1),2, 1 + 8)

 IF lnScan <> 0 THEN 
  loRet.Database.Tables(lnMi).ConnectionProperties.Item("Data Source").Value = JUSTPATH(laTbl[lnScan, 1]) + "\"
  loRet.Database.Tables(lnMi).Location = JUSTSTEM(laTbl[lnScan, 1])
 ENDIF							&& lnScan <> 0
 

NEXT

loRet.ExportOptions.FormatType = crEFTPortableDocFormat
loRet.ExportOptions.DestinationType = crEDTDiskFile
loRet.ExportOptions.DiskFileName = "C:\temp\report1.PDF"
loRet.Export(.F.) 

Hope it help.
Nro

RE: How to use CrystalReport 2016 from VFP9.0

(OP)
I am not getting the link to download CR11 on the site of crystal report. Is there any free version CR11 available for 1 month?
Just to clear, Are you using Crystal report 14 or 11?

RE: How to use CrystalReport 2016 from VFP9.0

>Xrystal 14 or 11
You can answer that from the code. Look at what object NRO creates: CrystalRuntime.Application.11

If that isn't available for you, don't go for a CR11 download, just use either CrystalRuntime.Application.14 or CrystalRuntime.Application, this is not Crystal specific, this is also valid for other OLE automation server classes, eg Word.Application.15 would be Word 2013 and Word.Application.16 is Word 2016, but there always also is the general OLE class name Word.Application or CrystalRuntime.Application, which would address whatever is the mainly registered version, i.e. the default for docx file extension or for rpt file extension.

Bye, Olaf.

RE: How to use CrystalReport 2016 from VFP9.0

Hi Beginner

I’m sorry, I was not clear enough (English is not my first language)

The Crystal Report RDC ActiveX is deprecated in Crystal 9. They still ship it until Crystal XI R2 but after that, it’s no longer available. That’s the reason I’m using CrystalRuntime.Application.11 ActiveX control.

You can download the ActiveX Merge Module (11) for free from my previous post. Now, this ActiveX is only needed for VFP automation and it’s working perfectly.

To design your report, you can use the latest Crystal report (ver. 2016) from SAP site. You can download a free trial to test. The full licence cost 495$

SAP is now developing a .NET approach for automation, but again, you can embed your reports into .Net application as well as VFP.

Bye

Nro

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close