Code for running a report

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
Eddie_Marshall
Posts: 122
Joined: Tue Oct 10, 2017 12:44 pm

Code for running a report

Post by Eddie_Marshall » Tue Dec 03, 2002 10:07 am

[updated:LAST EDITED ON Dec-31-02 AT 02:34 PM (EST) by ()]We have a foxpro program from which we want to automatically run an R&R report. Does anyone have a more slick way of running an R&R report from within another application? At present we use the following code to run the report :- _____Declare integer ShellExecute in Shell32.dll integer, string, string, string, string, integer___LnHwnd = ShellExecute(0, ^Open^, ^RRWRUN.EXE^, o_path[3] ^RRWRUNIN /WY /O^ o_path[3] ^RRUNOUT.DBF /B^,^1^, 1) ___WAIT WINDOW NOWAIT ^Waiting for R&R report to finish...^___do while !file(o_path[3] ^rrunout.dbf^)___enddo____WAIT WINDOW ^Waiting for R&R report to finish...^ TIMEOUT 5___*above line inserted to give R&R time to write rrunout structure - avoiding ^not a table^ error___WAIT WINDOW NOWAIT ^Waiting for R&R report to finish...^___sele 0___USE (o_path[3] ^rrunout.dbf^)___do while reccount()=0____WAIT WINDOW ^Waiting for R&R report to finish...^ timeout 1____*stay here until user finishes with R&R report____*otherwise get file access denied if you run report again.___enddo___use___wait clear____Thanks in advance.____Eddie Marshall__Technical Support Manager__LandMaster____eddie@landmaster.co.uk__

Payday Loan
Posts: 0
Joined: Thu Mar 29, 2018 5:21 am

=> RE: Code for running a report

Post by Payday Loan » Fri Dec 13, 2002 2:00 pm

I have written about this problem to the various R&R publishers since they first released 6.5 (first Windows version). I thought Foxpro and its terrible built in report facilities were a perfect match for R&R but this problem make our software look like trash. I even posted this here when this discussion area opened.____Too many years and too many expensive upgrades when this has been a problem forever.________

freitas
Posts: 68
Joined: Tue Oct 10, 2017 12:44 pm

==> RE: Code for running a report

Post by freitas » Fri Dec 13, 2002 2:53 pm

[updated:LAST EDITED ON Dec-13-02 AT 02:53 PM (EST)]I use Visual dBase and call R&R from the program. You must first make sure that all databases are closed. The code which I use, and may be different for foxpro, is:____run(.t.,"rrwrun.exe rrwrunin <N>" )____.t. means that it is a windows program. The rest must be in quotes. rrwrunin is the control file for the reports and <N> is the number for the report.____Tom Freitas

rickwjohnson
Posts: 49
Joined: Tue Oct 10, 2017 12:44 pm

===> RE: Code for running a report

Post by rickwjohnson » Fri Dec 13, 2002 5:22 pm

I second the response from Freitas. I have entire reporting systems and series of reports that use this construct. Whatever is the command in Foxpro to execute a windows program should do it for you with nothing else. I, like Freitas, collect any user info, write it to a record in rrwrunin.dbf, close all databases, and issue the command. I have rrwrunin tables (I actually rename them based on the project) with over 30 reports in ithem various projects. In fact, in Visual dBase, you can just issue this command from the command window.____Good Luck______Rick Johnson__Rick Johnson

Tom_Mills
Posts: 20
Joined: Tue Oct 10, 2017 12:44 pm

====> Front End

Post by Tom_Mills » Tue Dec 17, 2002 1:18 pm

R&R keeps coming out with major changes I could care less about (Librarian, etc), while ignoring the fact that they need a really slick front end to run reports from.____They give us icons, and Rapid Runner (which is a good start). ____But nothing they give us allows us to define pull down lists for prompts etc. Imagine being able to pick one or more Parts from your Parts list which is dynamic. ____Crystal can only give you a static list, so that everytime you got a new widget, you^d have to find every report and re-do the list.____But we certainly wouldn^t want to have an advantage over Crystal!!____I certainly think Liveware wants to generate revenue. This is something my organization would pay for.__

Payday Loan
Posts: 0
Joined: Thu Mar 29, 2018 5:21 am

=====> RE: Front End

Post by Payday Loan » Thu Dec 26, 2002 4:32 pm

Tom and Rick,____I know how to run a report. But I can^t know when it is done.____For example, lets say I have a customer data base and I need to print just one state. Here is my code:____Select 0__use customer____copy to temp for state = "NY"____Run rrwrun rrwrunin 1 && prints a reports using the temp data base____delete file temp.dbf____return____Guess what happens? It tries to erase the temp.dbf before the report starts. What I am asking for is something like.______run rrwrun rrwrunin 1____do while .t.____if itisdone()__ delete file temp.dbf__ exit__endif____enddo______The first post uses the existence of rrunout.dbf to determine "isitdone" and it is a great start. But it gives false results on my XP tests.____Please don^t suggest alternatives to my temp data base, it is just an example for much more complicated code. And that code can^t execute until my customer has read the report on the screen.______

Tom_Freitas_(Guest)
Posts: 32
Joined: Tue Oct 10, 2017 12:44 pm

======> RE: Front End

Post by Tom_Freitas_(Guest) » Fri Dec 27, 2002 10:30 am

Like all report writers, this is a program that utilizes databases and is not meant as a front end device. Once you have created a report, you can then tell R&R what to do through a database program like FoxPro or Visual dBase. What I do is create a temporary control file by duplicating the rrwrunin.dbf to a unique control file for the person using the program. The control file starts with T for temporary and then their login ID. I then append everything from rrwrunin into the temporary file. In the rrwrunin I have added a field for type of report. This field lets the system know if it is a summary or detail report. The user will click on radio buttons for detail or summary, and only those reports that apply will display. If they check the filter report, the system then puts a ? in the field ri_filter, which brings up the filtering query screen. Once I am finished, the temporary file is then deleted.____I could go on for a while on all the other functions within the reporting program, but it would be to long.

Tom_Mills
Posts: 20
Joined: Tue Oct 10, 2017 12:44 pm

======> RE: Front End

Post by Tom_Mills » Fri Dec 27, 2002 10:34 am

In the runtime documentation there is a runtime status file. The implication is that you can check this file to see when your report is done. I haven^t actually done that myself, but it seems like a good idea to check that out.

Payday Loan
Posts: 0
Joined: Thu Mar 29, 2018 5:21 am

=======> RE: Front End

Post by Payday Loan » Fri Jan 10, 2003 2:13 pm

Tom and Tom,____First off, the file that gets created when the report is done is rrunout.dbf and the first message in this thread describes a method of using rrunout.dbf to determine completion.____As far as R&R not being a front end - I don^t know how that has anything to do with this subject. Let me give yet another example of my problem.____Most of my Fox apps have R&R reports and at some point they need to zip database files. Here is an example of ADDZIP:____close databases__ADDZIP() a backup__open the databases____The open is not executed until the ADDZIP is done and I do not do ANYTHING to the code to wait. It works perfectly. If it did not work, I would get a sharing violation when I try to open a dbf that was being zipped.______Now for R&R:____Create temp database__rr report it__delete temp database____Fails EVERY time. I have to add code to wait - looks like this:____Create temp database__rr report it__wait loop until rrunout.dbf available __wait another few seconds__delete temp database____See the difference? Has nothing to do with filters or queries. Nothing to do with front ends.____Was not in 6.5, 7, 8, 8.1, 9. Will it be in 10?____Mike________

Post Reply