FoxPro for DOS calling R&R V-9.0
Posted: Sun May 26, 2002 12:52 am
"Calling R&R V9.0 from FoxPro 2.6"__ __ Using R&R version 9.0 reports from FoxPro for DOS applications__If the heading to this article sounds exciting, it sure is. It means that many FoxPro for DOS applications that are considered _dying_ may get a new lease on life.____The most troubled part of an existing FoxPro for DOS application is the report printing. When using R&R for DOS version 5 (which was the last one published) you are faced with;__· A lack of printer drivers for the new printers in the market.__· Inability to print to a USB port printer.__· A limitation on the number of printers you can select (eight in total) and on a network this can be quite limiting.__· The necessity to _capture_ printer ports with NET USE LPTx command in Windows 2000 and higher.__· Very cumbersome to use fonts.__· Many other limitations.____The beauty in the solution in this article is the fact that you don_t have much to change in your FoxPro program. If you prompt your user for parameters before you call R&R for DOS, you will continue to do so with this solution.____How does it work? ____1. Convert your *.RP1 libraries to *.rp5 libraries. Version 9 has such a utility.__2. Open each report in R&R version 9, adjust page settings, fonts etc. and SAVE AS into an independent *.RRW report file into a selected subdirectory.__3. Ensure that the report names don_t contain the characters slash_/_ period_._ Hyphen _-_ or any other illegal character in Windows file naming conventions. (This was allowed in R&R for DOS ver 5. ____At this point you have done the R&R work. Now to the FoxPro application;____1. Add a new field to the R&R control file. (Usually called RRUNIN.DBF) named RI_PTWR size 40 and put question mark _?_ in all records.__2. Before issuing the call to R&R Version 9, Modify the following fields in the record to be printed;______· RI_LIBRARY - put blanks (as you are not using a library anymore).__· RI_OUTFILE - put blanks (as this is windows printing).__· RI_PRINTER - put _?_ (to allow the user to select a printer)____Now you are going to prepare the line that issues the call to R&R version 9 .____Prepare the parameters, /d (data subdirectory), /o (the output control file usually RRUNOUT.DBF) and the control table. An example would be:____m.var1 = _RRUNIN.DBF 13 /oc:mydir
runout.dbf /dc:mydirdata_____Now issue the call:____RUN RRWRUN.EXE &var1____Don_t use FOXSWAP or /N parameters in the above line.____That_s all. If you are running the DOS application in full windows, it will be minimized automatically and the first R&R version 9 window will appear asking for SCREEN PRINTER EXPORT options. When done, pressing <enter> will return you to the FoxPro application. If your application is running in a window, you will see the R&R screen on top of that window.____In Summary____You are invoking a 32 bit R&R application from FoxPro for DOS and it works smoothly. You now have full Windows reporting capability from a DOS application without changing much in the DOS application.____No more worries about printer drivers, USB ports, Print capturing and many other DOS headaches.____Joshua@geldman.com__905-760-9835 (voice)____ __