Populate of temp-tables from a class. - Forum - OpenEdge Development - Progress Community

Populate of temp-tables from a class.

 Forum

Populate of temp-tables from a class.

This question is not answered

Hi there!!!

I'm developing a quite large class (it handles creation of quite decent, dataset 20 or so temp-tables with corresponding relations).

It wil be on appserver side.  Fullfilled from several procedures, or stages of process.

(It is for Mexico's Electronic Bill)  (I'll open source it when finished)

I wonder, how is the best way to fill it.  For instance, there are processes to define data of myself, my customer, items, etc.  each item record fires 3 or 4 (sometimes 5) fill of other temp-tables, that's no problem.

Problem arises from one temp-table that has to be fullfilled with 20 fields or so.  What's the best use case for creating a record of it... I think sending 20 parameters to this procedure is some cumbersome.  Should I fill a local temptable, and send to procedure and then buffer-copy from one to another? i wouldn't like to define dataset outside of class, I want to encapsulate validation to the class, 

I'll be reading tonight chapter 2 of OERA.

Any suggestion?

Thanks

All Replies
  • One aspect may be to look at whether that dataset (“business entity” or “business service”) is correctly sized – it can be an indicator if you have a few giant objects/temp-tables.
     
    Do you need all of those child tables all the time? Can you populate them on a as-needed basis?
     
    IN general terms, I would say that (especially if you have big tables) you want as few copies of the data in memory as possible – even if you copy-and-clean you are still making copies. Obviously, passible data from a client to an appserver will cause a new copy, but in general terms I’d say that’s the only copy you want. That and the data in the db.
     
    If you need 20 parameters, you need 20 parameters, but I would go back to asking whether you need all the tables in the dataset all the time. That may influence your “”fill” .p’s
     
  • You should also read about Business Tasks (or Business Services as Peter referes to them here). The case sounds to me that with "yourself", customer, items, etc. there may be a few business entities which manage sub-sets of the data. The business tasks might provide the overall logic - and knows how to retrieve some bits first and then use keys of that data to retrieve the rest of the data.

    Also the business task could be used to transform that data from your internal view to the Mexican standard electronic bill structure.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • It just might you’ve been reading too much OERA already and it’s probably best to enjoy more pleasant literature once in a while :)

    There is hardly anything ‘decent’ abut such a beast and clearly your class it trying to do too much work on its own. You’re most probably trying to produce some form of output for data integration and the first obvious option seems to be to load everything in a dataset and then serialise that so that the other party understand it. This might work just fine if the data there is somehow limited, else another option is to use a ‘writer’ or an output stream and then just send various information into that one instead of preparing everything upfront and serialise afterward.

    For passing 20 parameters to a routine you better go with a ‘parameter object’ (Stefan mentioned that once, he will probably tell you more about it) and in 4GL world a temp-table or even a dataset are the easiest way to create those kind of ‘state only’ objects that can be used to pass information around. As long as you don’t pass that by reference it won’t affect the encapsulation and hence not ruin your karma, mind you in OO world encapsulation is not exactly that strict… it’s perfectly valid at times to have a list and give access to that to the outside world so anyone can update that directly instead of writing wrapper methods to get/add/delete objects in that list.

    Bref, if you still want to load everything upfront then just make an object that will hold that data and pass that around to all routines that need to fill data into it… do let anyone update the object, it’s not holding any logic anyway so just make it as lightweight as possible.
     
    Marian Edu

    Acorn IT 
    +40 740 036 212

  • I appreciate all input... and really sorry to have missed a clear idea of what i'm in front of at the moment.

    The thing is this:

    Having a sale given, I have to create an XML file to send to authorized supplier of certifying (PAC), so there is a clear specification of format (by www.sat.gob.mx/.../cfdv33.xsd).

    So at the very moment that i'm about to get signed this document, have to get extended info about me (that is the seller), about customer, extended info about items, and then put all inside the dataset and XML-WRITE it, sign locally by SSL and my certificate and encription key, put the digest in a node inside same document and send this file to PAC so it's signed by them and get back the same file with an extra node with info about the signing, at this moment I know the document was authorized (it could be the case that it is rejected!!!), so have to make data permanent and store the signed xml.

    The XML has info of about just one sale, so it's one header, and several child rows (in my case is really small amount of child records, not more that 10) each item has 2 or three related records.  So it's not massive. 2019 law, will force me to make 30 bill documents, each with 1,000s rows, so that _wil_ be really big.  The authorities sell us the idea of fiscal system in Mexico is most advanced in the world... not sure, but....

    So this is somewhat broader panorama of project at hand.

    TIA

  • The mentioned 30 bills with 1,000's rows, is 30 of them a day, 363 days a year... /mind  Jan 1st, and Dec 25th/

    In two and a half years from now will be 200 bills a day.  In five years will be 1,000 bills a day,,  And I'm convinced I'm on the right platform and database...

  • Forget about DOM, use SAX if possible... check out Scott’s new ‘parser’ maybe it helps you...

    Sent from outer space