Alpha Video Training
Page 1 of 3 123 LastLast
Results 1 to 30 of 87

Thread: Limit number of records to print on report

  1. #1
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Limit number of records to print on report

    I have a report name "Medical" I need the report to print the lastest 6 records "DUE: This would apply to Injections, Wormer and Weight.
    The records are in an embeded browse on a tabed form labeled Medical.
    The events for the browses are onArrive "Quick sport-sort record, placing the last dates at the top of the browse.

    I check the help file and looked at count(). I can't make it work.
    Any help would be great.
    Attached is my application.

    Jim

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

    Default Re: Limit niumber of records to print on report

    I think this can be done by marking the desired child table records first, then using the marks in filter expressions in each of three subreports. Each subreport to be based on a separate child table.) In limited testing here was unable to get top_records() or bottom_records() to work with subreports. However, a filter based on marked() works fine.

    -- tom

  3. #3
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit niumber of records to print on report

    Tom.
    Remember I have been using ALPH 5 for only 4 months.
    You will have to explain your suggestion to me a little more.
    Jim

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

    Default Re: Limit niumber of records to print on report

    Jim,

    I see "Due" for Injections.
    I see "Wormer_Due" for Wormer
    I don't see "Due" for Weight.

    what am I missing? Which Weight records do you want included in the report, which do you want excluded?

    Your set includes 3 child tables, each linked one to many back to the parent table. I understand you want to limit the number of records included in the report for each child table. Is that right?
    Last edited by Tom Cone Jr; 04-30-2007 at 08:20 AM.

  5. #5
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit niumber of records to print on report

    There is no due for weight. Want the lastest 5 or 6 records for "Date".

    Yes, 3 child tables linked to the parent.

    Yes, I want to limit the number of records included in the report for each child table. Look at the medical report, I want it to show the lastest 5 or 6 records .
    Under heading Injections show: date, injections, due - sorted by lastest due
    Under heading wormer- show: date, wormer and due - sorted by lasted due
    Under heading weight- show date and weight - sort by lastest date.

    I have the sorts working from the form medical and prints correct on the report but I need to limit the records on the report as there may be a large number of records in the tables over the years of record keeping.
    Jim

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

    Default Re: Limit niumber of records to print on report

    My idea would be to run a script that would preprocess the child table records marking records that should appear in the report and unmarking all the others. The fields you want to display from each child would be placed in a subreport, and the subreport would be filtered to include only marked records. This is a brute force solution. There may be other (better) ideas, so let's see if someone else suggests a better approach.

  7. #7
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit niumber of records to print on report

    I have been trying "Top_Records()"
    Syntax: Filter_Expression as C = TOP_RECORDS (Quanity as N [,Filter as c ])
    Get error: Invalid or incomplete expression.
    Not sure if I have the description right in the arguments.

    I placed this filter in the "Detail Properties" in the field for 'Expression Filter" on the report. This may be totally wrong but isn't this where you filter the records that you want printed?
    Jim

  8. #8
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: Limit niumber of records to print on report

    Put 3 subreports in your report each based upon each of the child tables. You can't just put the fields in the detail section as you have for this purpose. Then try using this filter in each of the subreports:

    BOTTOM_RECORDS()

    Syntax:

    Filter_Expression as C = BOTTOM_RECORDS( Quantity as N [, Filter as C ] )


    - - - or maybe top_records()?

  9. #9
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Peter,
    You suggestion of sub reports was great-makes for a better report.

    However I tried the TOP_records for a filter on table "injection". When you save the report and then go back and look at the filter- the table is greyed out and shows the table as "llama". When opening the report it starts counting records into thousands and you have to abort.

    Where did I go wrong?
    Jim

  10. #10
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: Limit number of records to print on report

    Quote Originally Posted by jdoyle View Post
    Where did I go wrong?
    Not sure, Jim. Do you have the subreport based upon each child table? The filter in each subreoport should be something like: scanning("child table name") .and. top_RECORDS( Quantity as N [, Filter as C ] ) - - - something like that

  11. #11
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Yes, sub report base on each child table.
    Tried the filter and it is obvious that I don't know what I am doing.
    Attached is database
    Jim

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

    Default Re: Limit number of records to print on report

    Peter, as reported above, your idea is exactly what I attempted last night without success. I've sort of half way concluded that top_records() is limited to filters on the primary table, and cannot be used when defining a filter for a child table. Would like very much to be proven wrong, but can't spend any more time on it.

    -- tom

  13. #13
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Limit number of records to print on report

    Jim,

    You have dates for these records. Would it not be easier to print the records that fall between 2 dates? That filter would definitely work.

    I can get the subs to work fine,but cannot find the functions that have been proposed anywhere. I am sure they are there, but not for me.


    I have changed a few things, maybe from there???

    Dave
    Last edited by DaveM; 04-30-2007 at 03:58 PM.

  14. #14
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: Limit number of records to print on report

    Quote Originally Posted by Tom Cone Jr View Post
    Peter, as reported above, your idea is exactly what I attempted last night without success. I've sort of half way concluded that top_records() is limited to filters on the primary table, and cannot be used when defining a filter for a child table.
    Sorry, Tom. I missed your post somehow. Bummer that doesn't work!

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

    Default Re: Limit number of records to print on report

    Peter, this was my first experience trying to use top_records() or bottom_records() so I'd welcome another try by someone else in case I was doing something stupid.

  16. #16
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Limit number of records to print on report

    sorry here it is maybe??

  17. #17
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Limit number of records to print on report

    Tom, I couldn't get them to work either. May be me though.

    Dave

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

    Default Re: Limit number of records to print on report

    Dave,

    I think Jim may need to include child table records even if their due dates are outside the date range set for primary table records. Filtering at the primary table level won't help him, I don't think. He probably wants to see all the parent table records (unfiltered) but then only see the most recent "due dates" for the 3 child tables, regardless of how hold they may be. It's an interesting puzzle. I've verified that the brute force approach will work but it's going to be a lot of work to implement.

    -- tom

  19. #19
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: Limit number of records to print on report

    Using Tom's "brute force" method I created two functions - one marks, the other unmarks the last six records for each child. On your tabbed form's 2nd tab, I added a big ugly button that runs the two functions with a print preview in between. I modified the child subreport filters, as well.

    See attached...

  20. #20
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Dave,
    Thanks for your reply. The report works with the subs added but dosn't limit the number of records printed. Also tried filtering between dates which works. However when this app. is finished, it is to be used by my wife, who does not anything accept push a button and it does it automatic. She would never be able to understand the filtering issue.

    Tom,
    You are right in your last post about the child tables. But what do you mean by brute force? I am just one or two steps above my dear wife in program knowledge. LOL.

    Attached is database that has been cleaned up somewhat.
    If anyone has another suggestion it would be appreciated.

    Thanks all for the help
    Jim

  21. #21
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Limit number of records to print on report

    J,

    The date thing does not have to be something she does a lot with. It can be setup automatically, like I do with csi letters where the filter is set to filter = between(dbdate, date-30, dat+30). Or you could set the button to prompt with a dialog box for the 2 dates to use. these would of course be filters for the sub reports.

    Good Luck!

    Dave

  22. #22
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Peter,
    The print button does it as you say. But it prints the last 6 records for all llamas, not the last 6 for an individual llama or the one that has focus at that time. In the filter expression could it not scan for an index "llamaid" and show the last 6 record for that llama?

    Thanks
    Jim

  23. #23
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: Limit number of records to print on report

    Ok, Jim.

    See if this works for you...

  24. #24
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Hey Peter,
    You are a genius!
    Why would I be getting and error; "Bad Object Handle" on closeing the tab medical? You can close the form from any of the other tabs and not get the error. I think I understand the item "object", but can not find any object with an error. Otherwise, works great as far as the report. In fact a better solution than I first envisioned.

    This message board is one of the best on the web. Clarion, Access, FoxPro and other do not have one as good. The members here are aways glad to help even though I am sure that all of you have other things and jobs to do.
    I am very impressed with ALPH 5 ver 8! I learning by trial and error and the great help from the members. I hope someday I can return the favor.

    Again Thanks to All -Peter, Dave, Tom

  25. #25
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: Limit number of records to print on report

    Quote Originally Posted by jdoyle View Post
    Why would I be getting and error; "Bad Object Handle" on closeing the tab medical? You can close the form from any of the other tabs and not get the error. I think I understand the item "object", but can not find any object with an error.
    I don't get that on my copy. Perhaps something got corrupted along the way. Unfortunately, that error is a real pain since it does not tell you which object is bad. Copy the form to a duplicate and then begin deleting objects one at a time until the error goes away. It's tough on a complex form such as yours.

  26. #26
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Peter,
    You were right. Somthing got corrupted unpacking the zip. Deleted the files in the directory and unpacked again and now works fime

    Thanks for you Help
    Jim

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

    Default Re: Limit number of records to print on report

    But what do you mean by brute force?
    Jim,

    In this context I meant that the solution I was thinking of forced a filter expression to work by making it easy for Alpha Five to "see" the records I wanted to include. i.e. by marking them. In other contexts this expression often means doing the same processing on a series of records, one record at a time, over and over.

  28. #28
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Peter,
    The filter function that you help me with works, but it show the last 6 records enterd in the table, not the last 6 for that one llama. If you look at the llama, Allie she has 3 injection records and prints 3, Annie Lee has 3 injection records and prints 2, Annina Lee has 3 injection records and prints 1 for a total of 6 from the table. If you add another injection record for any other llama then the records printed will be no more that 6 for all of the llamas. Do I have an indexing problem?
    Attached database
    Jim

  29. #29
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Limit number of records to print on report

    Last edited by G Gabriel; 05-11-2007 at 06:15 AM.

  30. #30
    Member
    Real Name
    Jim Doyle
    Join Date
    Dec 2006
    Location
    Krum, Texas
    Posts
    213

    Default Re: Limit number of records to print on report

    Hey,
    Real Name: .not.Moe

    Thanks for your help! The app. now works like I want.

    Sorry about slow reply, because of honey do's and the message board being down.
    Real Name: .t.Jim

Similar Threads

  1. Limit on the number of displayable records?
    By Michael Vytilingam in forum Web Application Server v6
    Replies: 5
    Last Post: 08-22-2005, 06:32 AM
  2. Limit printed records in report
    By Jeremy Lowe in forum Alpha Five Version 5
    Replies: 7
    Last Post: 08-05-2004, 08:37 AM
  3. Limiting detail records in report by number
    By Roman Galaska in forum Alpha Five Version 5
    Replies: 4
    Last Post: 01-17-2003, 06:21 AM
  4. limit records per page on report
    By Jim Chapman in forum Alpha Five Version 4
    Replies: 7
    Last Post: 07-07-2000, 10:27 PM
  5. Report print of certain records
    By Pam Smart in forum Alpha Five Versions 2 and 3
    Replies: 1
    Last Post: 06-20-2000, 04:13 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
  •