Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Program that only prints a report
Message
 
 
À
22/03/2016 11:03:33
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01633497
Message ID:
01633507
Vues:
46
>>>>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 :)

I agree :)
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform