Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Selecting Records to Print

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Selecting Records to Print

    I am having a problem selecting records to print. I have a checkbook, where I need to print only the last 50 records of the database on a page. The checkbook database is sorted by Checkdate+Checknum.

    I have looked in this forum and in the Help file, but can't find a good solution, although it seems obvious that it should be fairly straightforward.

    Any help would be greatly appreciated.

    Charlie

    #2
    Charlie, how do you define "last 50 records" ?

    -- tom

    Comment


      #3
      Originally posted by Charles Hoens
      I am having a problem selecting records to print. I have a checkbook, where I need to print only the last 50 records of the database on a page. The checkbook database is sorted by Checkdate+Checknum.

      I have looked in this forum and in the Help file, but can't find a good solution, although it seems obvious that it should be fairly straightforward.

      Any help would be greatly appreciated.

      Charlie
      I think you could do this with a button on a form based on the checkbook table. Something like

      Code:
      tbl = table.current()
      query.filter = ""
      query.order = "cdate(Checkdate)+alltrim(str(Checknum))"
      qry = tbl.query_create()
      recs = qry.records_get()
      
      rep.filter = "between(recno(),"+(recs-49)+","+recs+")"
      rep.order = "cdate(Checkdate)+alltrim(str(Checknum))"
      
      report.print("reportname",rep.filter,rep.order)
      There can be only one.

      Comment


        #4
        Records to Print

        Thanks Stan. I was working along those lines, but got stumped on the query. Will this select the last 50 records (to answer Tom's query) that are in the index or just the last 50 in recno() order?

        What we need (as an aside) is a good dBaseIII command called Skip(). Within the parens you used to put a number and the Skip() command would take you to that record. i.e. Skip(50) would move you forward 50 records even in an indexed database. Also Skip(-50) would take you back 50 records, so in this case it used to be easy because you would fetch_eof() then Skip(-50) and there you were and could print from there.

        I also found this to be useful when opening a browse/form. Oftentimes you do not not to see the first record of a browse, but the last 50 or so records.

        Alas, I haven't been able to achieve this feat. Maybe it should go into the "Wish List" unless I can find another way to do it. I've tried several long ways, but they are all inefficient and slow. (i.e. fetch_prev() 50 times)

        Thanks,

        Charlie

        Comment


          #5
          One simple approach may be to let Alpha do the work for us.

          rep_filter = "bottom_records(50,\"\")"
          rep_order = "Checkdate+Checknum"
          Report.print("reportname",rep_filter,rep_order)
          Last edited by Stan Mathews; 12-27-2005, 11:46 AM.
          There can be only one.

          Comment


            #6
            Running Total

            Stan,

            This is all working now. Thanks so much!

            One more complexity though. Becasue this is a checkbook listing, I have a column in the far right showing the Running Total. If I run the report with all records, this total runs and displays fine, however if I filter it for just the last 50 records, the total is wrong.

            What I am thinking about is a way to run some code to run the report, find the 50th from the bottom record, record in a variable the Running Total at that point, then re-run the report for real and use this variable to then calculate what the real Running Total should be on the report.

            If you have any ideas, please let me know. Or is my approach wrong? I'm working on it now.

            Many thanks as always,

            Charlie

            Comment


              #7
              Problem Solved?

              Stan,

              I played around with it for awhile and came up with the following code, which for me, at least, solves the problem. It's brute force, but it seems to do the job and I added the code just before I went to print.

              t= table.open("checkreg")
              query.filter = ""
              query.order = "cdate(paiddate)+alltrim(Cknum)"
              qry = t.query_create()
              recs = qry.records_get()

              dim totbal as n
              dim runbal as n
              dim recnum as n
              dim global ckstart as n
              recnum=0
              runbal = 0
              totbal=round(tablesum("checkreg",".t.","paidamt")*-1,2)
              t.fetch_last()
              while recnum < 48
              runbal=runbal+t.paidamt
              t.fetch_prev()
              recnum=recnum+1
              end while
              t.close()
              ckstart=round(totbal+runbal,2)

              In the body of my report I defined the field I wanted to have the running total in as follows: runbal = (run_total(Paidamt)*-1)+var->ckstart

              What do you think???

              Charlie

              PS: Everything with me is brute force! That's why I love Alpha. It allows me to bang away at things, yet admire the elegance of others!

              Comment


                #8
                Checkbook

                Charles, There has been alot of inquiries on how to create a workable checkbook that goes back to (I think) ver 4. Maybe you can give us a sample program on how you managed to do it. I've tried several times but can't get one to work exactly live Quicken.

                Jerry

                Comment


                  #9
                  Checkbook

                  Jerry,

                  I think the best rendition on how to make a checkbook (along with explanations) was Dr. Wayne's book on Alpha. I still use it as a reference guide!

                  My personal solution to it was to put all my information into a browse on a form. On the side of the form I placed several calculated fields, such as total balance, unreconciled balance, reconciled balance, running total (which changes when I change the browse position) and bank balance. In my app, I calculate the bank statement balance so all I have to do is check off the checks and deposits from the statement and then compare the bank statement balance to what I have on the screen.

                  Doing it this way, gets around the massive problem of having to redo the database just in order to get a display on a screen browse. On the report, the running balance works fine.

                  Let me know if you need the calculated fields.

                  Charlie

                  Comment


                    #10
                    Checkbook

                    Charles, since you're still on line. I would be interested in the calculations. I have trouble with the running balance. In ver 3 (dos) it was easy, but haven't figured out exactly how to do it. Tom Cone gave some suggestions but couldn't get that either. (on another app)

                    thanks

                    jerry

                    Comment

                    Working...
                    X