Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Program that only prints a report
Message
From
22/03/2016 11:03:33
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01633497
Message ID:
01633505
Views:
41
>>>Hi,
>>>
>>>I am creating a small project/program that will have only one purpose, to print a one-page report. As follows:
>>>1. The program will receive a parameter, order number.
>>>2. Based on the received order number, the program will connect to the SQL Server database, run SQL Select (get the record joined with a couple of other records)
>>>3. Print one-page report of this order.
>>>
>>>I am thinking of doing the entire code in the MAIN.PRG, where the parameter will be received. Another approach is to create a class instantiated in the MAIN.PRG and do the code in this class.
>>>
>>>My question is, are there any advantages of coding in the class vs. right in the MAIN.PRG?
>>>
>>>Note that once the program runs it should close immediately. So I won't even have READ EVENTS.
>>>
>>>TIA
>>
>>Depends.
>>
>>If it is just run a report: Data gathering - creating data for output - run report to printer and you are done. Should run pretty well on a prg. Class is just overhead and wrapper.
>>
>>If you a all-OOP-developer there is only OOP.
>>
>>My reporting runs through a generic form that gathers the data. All my reports depend on this form. So to create the data I need, I must run the code that is burried in objects of that form and so on. I think I will automate this form rather then invent it again. (And maintain two code snippets doing the same) I can not output a simple header on a report without raising a bunch of objects, because all depends on a meta structure where I gather language dependend strings from. The information what language to use - object. Recent report setings - object.
>>
>>So you have to decide:
>>Do you reuse something?
>>If it is new, might it be possibly be used interactive somewhere else? And if, how is your normal reporting working?
>>Might it be cheaper to reinvent the wheel then automation to existing user controled something? Or will the problem come again and again and automation is cheaper?
>>
>>BTW
>>The read events is not bound to using classes - it's only to bring the whole system into a state that is waiting for events and delegate them to event handlers (That what you see as menu or click or the like.) If you issue READ EVENTS without any handler it will wait for nothing. Until power down.
>>You can freely create a class, let its methods work, and destroy it. There is no need for events in this.
>>
>>There is no yes / no simple answer without closer knowledge to your program. :)
>
>Thank you very much for your detailed input. I am re-using some code used in another project and a global class I use to connect to the SQL Server. I will try - as my draft 1 of the project - to put all code in the MAIN.PRG and see if I run into any walls.

Be lazy. If you have something working - use it :)
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform