multiple forms per report?

  • I need to create reporting application that gets information
    from a query against an attached database. I've discovered
    that process works well.

    The difficult part stems from that fact that the report may consist
    of several different forms each relating to a different subset of the
    data returned by the query. Forms 1, 2, and 3 may make up one report,
    forms 1, 4, 5 and 7 may make up another report and forms 1, 6 and 7 might make up a still another report.

    It may take days trying to figure out the process. I'm thinking that I need to
    1) execute my Query
    2) if recordcount > 0 CreateFile
    3) write data to the form 1 and do a writePage
    4) for pages 2 to 7 test data to decide if form is needed,
    if so load that form, write data to it, and then do a writePage for that form
    5) get next record
    6) when no more records closefile and send to previewDialog.

    I. Does this make sense?
    II. How do I load the individual forms?

    A somewhat related question; when I insert a field to the form it comes
    with an outline. How do I programatically hide that box.

  • I did find that I could put a single line text object on the from with a name and a datafield that would update as I desired, rather than using the insert field at run time as I had in my earlier trial. Putting the text object on at design time allowed setting the lines.width property to 0, resulting in no more box!!!

    The loadfromfile action allowed loading different form files but that ended up not being the proper solution. I made each of my earlier forms a page of the final form. Using CreateFile, WritePage(n), and CloseFile I was able to accomplish my task. Thanks for all the help.

    rb

  • I have a program simialr to what you describe.

    In my program, the user builds a form based on individual pages. So, for example, there are a library of pre-built forms (single pages) for them to choose from. They select pages to add to their report. When I save the file, I save to the stream not only the form, but the names of each page. So, in a listbox that displays on the left, it shows all the forms in their report. They click on one to jump to it, and can move pages up, down, or delete to change the order of pages in their report (a use might need a photo page, a comment page, a particular form, etc).

    What I did was if a page was create two WPFormEditors, one visible and one not. I open the form needed in the invisible one, then paste that to a new page in the visible one. When th user saves their report, it first writes the contents of the listbox showing all the forms and their order that they added them, then writes the contents of the form )report) they created.

    So, in your case, you can add a new page and, if a different form is needed, you can open it in a blank editor, insert a new page to your main editor, then paste it over. The thing to be careful of is NOT to overwrite original forms.

    Hopefully I am understanding what you want to do. But it would seem that you could do pretty much the same thing...apply pre-defined forms IF they are needed to a new form set.

    JD

    • Offizieller Beitrag

    This is a good solution.

    I only want to drop in the possibility to save the selection (not using Copy&Paste) using procedure

    procedure SaveSelectionToStream(s: TStream; var x, y, w, h: Single);

    The selection will be saved normalized, meaning the top x,y coordinate is 0. Therefor the var parameter is set to the offset which can be then used in

    procedure LoadSelectionFromStream(s: TStream; XOffset, YOffset: Single);