Alpha Video Training
Results 1 to 27 of 27

Thread: Print Current Record Problem with Child Record

  1. #1
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default Print Current Record Problem with Child Record

    I am trying to print a form for a set showing data from both the parent and child record. I only want one form to print for the child record selected from an embedded browse (or shown on the tabbed subform) but Print Current Record is not working. It is printing a form for EVERY child record. I was able to do this in Alpha4 by using the Quick Print Form option. I thought this was working OK in Alpha5 by creating a Print Button and selecting the correct events (Print Layout - (named form) - Print Current Record), but now I cannot get this to print only one document. I have even set the form filter for the child database to recno()=current(rec(no)). I am truly stumped here. Any help is greatly appreciated.

  2. #2
    Greg Suhok
    Guest

    Default RE: Print Current Record Problem with Child Record

    Is the form you are printing based on the set or the child table? It should be based on the child table only. But, I would suggest printing a report and not a form. I have had problems printing forms in the past.

  3. #3
    Greg Suhok
    Guest

    Default RE: Print Current Record Problem with Child Record

    Here is some code that I came up with that executes for the OnRowDblClick event of an embedded browse object. The envelopes report is based on the child table. I set the currentRecord variable to the record number of the child table(table.current(4)) and then filter by it in the report filter. Hope this helps.

    dim response as c
    dim currentRecord as c

    response = ui_get_radio("Select One", 1, "Print", "Preview")
    if (response = "Print") then
    goto print
    else if (response = "Preview") then
    goto preview
    else
    goto cleanup
    end if

    print:
    currentRecord = str(table.current(4).recno(), 10, 0)
    currentRecord = alltrim(currentRecord)

    :Report.print("Envelopes","between(recno(),"+ currentRecord + "," + currentRecord +")")
    goto cleanup
    preview:
    currentRecord = alltrim(str(table.current(4).recno(),10,0))
    :Report.preview("Envelopes","between(recno(),"+ currentRecord + "," + currentRecord +")")
    goto cleanup
    cleanup:
    parentform.resynch()
    end

  4. #4
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    Thank you for the tip. I am trying to print a form defined for a set. This executed well in Alpha4. Seems Aplha5 has a problem in this area. I should not have to define a report but will take this as a possible last resort. Also, if I can define a form that has fields from parent and a child record, I should be able to print that form or any other form I invoke with the same fields and record selection. What am I missing here? It must be something very obvious! Help!

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Print Current Record Problem with Child Record

    "I should not have to define a report" - easier than it sounds. Start with a new blank report in design mode, select the report menu, bottom choice should be "import", choose your desired form, you're done.

  6. #6
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    I'm going to try this. If it works, your my Alpha5 hero!

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Print Current Record Problem with Child Record

    Deb,

    Printing in Windows is VERY different than printing in DOS. The print support for Forms in Alpha Five is rudimentary. It will not print certain complex forms at all. The report engine is robust and flexible. My recommendation: use report layouts for your output, forms for your input. -- tom

  8. #8
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    Your tip on importing a form to a blank report is great! Still working on printing the report correctly. Thanks.

  9. #9
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    I have taken the report avenue and still cannot print a data from a parent record and a "single selected" child record. Both forms and reports want to include data from all child records and print multiple outputs. The issue in not print control but rather record control for both parent and child tables. I really think this is an Alpha5 bug because I was able to do this rather easily in Alpha4.

  10. #10
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    I have taken the report avenue and still cannot print data from a parent record and a "single selected" child record. Both forms and reports want to include data from all child records and print multiple outputs. The issue is not print control but rather record control for both parent and child tables. I really think this is an Alpha5 bug because I was able to do this rather easily in Alpha4.

  11. #11
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    Your tip was real good but did not solve my problem. Record selection and control has the same problem in report printing as it does in form printing. I want data from a parent table and a "single selected" child table to print on a form or a report. This is a confirmation form to be sent to a guest who has more than one reservation.

  12. #12
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print Current Record Problem with Child Record

    Deb,
    The easiest way to do this is to define a reverse set. In other words, make a set where your current child is the parent and vice versa. This can be a 1:1 link. Make a report showing what you want to show.
    To print it from a button have action scripting use the "value from the control on a form" make this the linking value that you want and run the report. This should take care of the problem.

    Russ

  13. #13
    Member
    Real Name
    RT
    Join Date
    Apr 2000
    Posts
    726

    Default RE: Print Current Record Problem with Child Record

    Hi Deb:

    You wrote:

    [I really think this is an Alpha5 bug because I was able to do this rather easily in Alpha4..]

    In my opinion, this not a bug, I don’t think there is a problem. I can easily click on a button and print the current record [Parent and the appropriate Child Records] via a report. From my perspective this is not an Alpha Five issue.

    At this point in time, I don’t think you are familiar with the Windows paradigm, so what you perceive as a bug, is really a lack of knowledge on your part. I am not saying this to be critical, because all of us went through that same learning curve when we switched from A4 to A5.

    Incidentally, it appears as if other forum members are trying to point out that you should not try to print forms, it’s going to cause you far more problems than it’s worth.

    Robert T

  14. #14
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Print Current Record Problem with Child Record

    Deb,

    Here's a working example for you to tear apart.

    Unzip the attachment to an empty folder. Open the only form. You'll find that it's based on a one to many set composed of Customers and Phones tables. The Print Current button previews a report based on the same set, using an action script that has two simple actions in it. The first builds a global variable containing the string equivalents of key fields culled from both primary and child table current records. The second preview the report using a simple filter expression to show only records that match the variable.

    -- tom

  15. #15
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    This sounds promising and I will try it now and let you know if it works. Thanks.

  16. #16
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    Russ,
    You are the greatest!!! This solution has really solved my problem. No special coding. I created the inverse set - Reservation.set (Reservations -> Demographics) instead of (Demographics -> Reservations). Created a new field in my reservation table called Print_Record. Then used Print_Record as a field on my Reservation and Confirmation forms. Created Print Buttons on the Guest Information form (has data from both tables) and used Events to select the forms for the INVERSE set. Then used my Print_Record as the "Value from the control on a form".

    I've been working on this problem for 4 days. I tried report definitions but they did not work for this application either. You are truly my hero tonight. I'd be more than happy to send you a dinner gift certificate to the restaurant of your choice.

    P. S. This should definitely go to the Tips bulletin.

  17. #17
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    Please see my response to Russ Boehle. He gave me a great way to accomplish what I need. I tried the Print Report route but it had the same problem selecting a single child record as the form route did. I still believe it's a deficiency in Alpha5 - but nonetheless, I've got a solution for the problem and can now proceed with the upgrade project. Thanks for your attention to the matter.

  18. #18
    Tim Langer
    Guest

    Default RE: Print Current Record Problem with Child Record

    It is very disappointing that V5 seems to have similar shortcomings to V1. I feel I have wasted $99.

    Why is it not possible to print a report (based on a set) for the current record being viewed? Why give a "current record" option in scripting if it doesn't work. I don't want the hassle of "reverse sets" etc.

    If this is just my ignorance I apologise in advance!

  19. #19
    Member
    Real Name
    RT
    Join Date
    Apr 2000
    Posts
    726

    Default RE: Print Current Record Problem with Child Record

    Hi Deb:

    Glad to hear that Russ was so helpful and your problem is resolved.

    Have fun with Alpha Five and I suspect you will fall in love with this product as you use it on a regular basis.

    Robert T.

  20. #20
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Print Current Record Problem with Child Record

    Tim, I think most believe that the term 'current record' when applied to a set based report or form is meant to refer to the current primary table record AND all linked child table records. For folks interpreting it this way the action script works as advertised. This thread contains three different ways of producing the single composite record report you seem to be seeking. None involve a great deal of work. -- tom

  21. #21
    Tim Langer
    Guest

    Default RE: Print Current Record Problem with Child Record

    "the current primary table record AND all linked child table records"

    This IS what I want the report to give but it doesn't. I select current record but I get all the records. Isn't this a bug? Likewise when I select File/Print Current Record/Form I get the current record only, but when I select File/Print Current Record/Report I get all records. I guess this means a fault in my report definition? I had hoped a database package for "Home" users would be more straightforward!

  22. #22
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Print Current Record Problem with Child Record

    Tim,

    I'm talking reports, sounds like you're talking forms.

    Have you tried using Action scripting to put a button on your form, programmed to print a specific report, but filtered to include only the current record ?

    -- tom

  23. #23
    Tim Langer
    Guest

    Default RE: Print Current Record Problem with Child Record

    I am talking reports, I just observed that File/Print Current Record/Form works, but File/Print Current Record/Report doesn't.

    I put a button on the form to print my report and then under "specify record selection criteria to apply in addition to those defined in the layout" I selected "current record only".

    I still have the same problem, and several other things I tried didn't work either.

  24. #24
    "Certified" Alphaholic
    Real Name
    Ohlen Cartmell
    Join Date
    Apr 2000
    Posts
    1,599

    Default RE: Print Current Record Problem with Child Record

    Since there are 1000s of programmers using A5 and 100's that regularly visit this forum, someone here knows the answer. Can you zip and post the table/set that's giving you the problem so someone can take a look.

  25. #25
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Print Current Record Problem with Child Record

    Tim, I fear your difficulty may be self-inflicted. Here's a simple example that uses action scripting to print a set based report for the 'current record'.

    Unzip the attachment to an empty folder.

    The script is on the only button on the only form in the database.

    Hope this helps to ease your frustrations.

    -- tom

  26. #26
    Member
    Real Name
    Deb Welch
    Join Date
    Jun 2003
    Posts
    141

    Default RE: Print Current Record Problem with Child Record

    Tim,

    I agree with you that A5 is really lacking in the "print current record" functions -- whether it be form printing or report printing; single child record or all child records. I got my workaround with the reverse set logic for single child record) and a calculated field that created a control for the child record(s). But it was a clumsy way to solve that problem and I fear that response time may become an issue every time users attempt to print a document. But no one seems to want to jump on our band wagon and the Alpha people seem to be in denial. C'est la vie!

  27. #27
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Print Current Record Problem with Child Record

    Deb,

    I guess you didn't find my query approach feasible?

    In any case, the method you chose to print the desired report will have a big impact on it's performance or speed. If the report is based on the inverted set, you can pass the filter key expression in the call that runs the report. If the filter expression you pass to the print or preview method qualifies for LQO then you'll get virtually instanteous response. Is this not what you're seeing ?

    I recall another thread, originaled by Cal Locklin in which he discussed his findings on the fastest ways to print filtered reports. You might try searching this forum, and the A5V4 forum to see if you can find it.

    -- tom

Similar Threads

  1. Print Current Record
    By debwelch in forum Alpha Five Version 6
    Replies: 0
    Last Post: 01-20-2005, 09:51 AM
  2. Print Current Record
    By Mortie in forum Alpha Five Version 5
    Replies: 0
    Last Post: 05-13-2004, 01:43 PM
  3. Print Current Record
    By Phil Rolf in forum Alpha Five Version 5
    Replies: 13
    Last Post: 02-09-2003, 04:29 AM
  4. Preferred way to print current record
    By Raymond Lyons in forum Alpha Five Version 5
    Replies: 1
    Last Post: 11-07-2002, 10:03 AM
  5. Print current record
    By 7ZNJABB in forum Alpha Five Version 4
    Replies: 3
    Last Post: 09-24-2001, 12:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •