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

Remove all but the most current records

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

    #16
    Re: Remove all but the most current records

    Peter:
    You solution will delete records that meet certain dates, subsequently, it could delete all records associated with certain Sec_sub_para if they fall within that range, or conversely, not all of the them and leave more than one if they are outside that range.

    It is not a set, but it's more like one.

    Comment


      #17
      Re: Remove all but the most current records

      Gabe I ran the summarize operation and based it on the "Date_Begin" field, and it seems to be working fine. It narrows the table down from approx. 7,000 records to 1949, which is exactly the target number I was expecting it to be.

      Unfortunately it creates a new table to do this, which is not exactly what I wanted, but that's okay, I can work with that. It's still a "quick and easy" method of filtering out the unecessary data.

      BTW, that's the first time I've used the "Summarize" function. It works like a champ!
      Sergeant Richard Hartnett
      Hyattsville City Police Department
      Maryland

      Comment


        #18
        Re: Remove all but the most current records

        Great.. but you should group by Sec_sub_para no date_begin.
        I will try to fix that zip file.

        Edited..
        Try the zip file now.

        Incidentally, if you don't want the extra table, you could write it over the original table, but that's a dangerous practice. You should back up first.
        Last edited by G Gabriel; 11-17-2007, 08:06 PM.

        Comment


          #19
          Re: Remove all but the most current records

          Actually I phrased it wrong. I DID group it by Sec_sub_para , but told it I wanted it summarized by the the LAST "Begin_Date" and it returns the correct records.
          Sergeant Richard Hartnett
          Hyattsville City Police Department
          Maryland

          Comment


            #20
            Re: Remove all but the most current records

            the LAST "Begin_Date
            That will work assuming the last date was entered last. To be on thesafe side, I used max instead.

            Comment


              #21
              Re: Remove all but the most current records

              Hmmm Okay, I'll use MAX instead. Thanks.
              Sergeant Richard Hartnett
              Hyattsville City Police Department
              Maryland

              Comment


                #22
                Re: Remove all but the most current records

                Hi all,

                I have been following along. I tried the summary op as Gabe has it and it works well. I did notice though that the summary op prefixes the field names with the summary type performed. I also tried using the original table as the result table but I end up with a table that has the field names changed but has no records.

                I wrote a little xbasic that results in the desired records but in the same table and the same field names.
                Code:
                Dim t as P
                dim duptest as C
                duptest=""
                
                t=table.open("trafcodetesttable")
                t.order("Sec_Sub_Pa+invert(cdate(N5))")
                t.fetch_first()
                duptest = t.Sec_sub_pa
                t.fetch_next()
                while .not. t.fetch_eof()
                    If t.Sec_sub_pa = duptest then
                        t.change_begin()
                        t.delete()
                        t.change_end()
                    else
                        duptest = t.Sec_sub_pa
                        t.fetch_next()
                    end if
                end while
                Gabe,

                I hadn't looked at the form in your example but now I see you had started to make the same script I did. :)
                Last edited by Tim Kiebert; 11-17-2007, 10:03 PM.
                Tim Kiebert
                Eagle Creek Citrus
                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                Comment


                  #23
                  Re: Remove all but the most current records

                  Tim, I like your script. Suggest a comment on the delete to remind yourself and others that Alpha Five will automatically fetch the next record after doing the delete. I also think it's prudent to close the table when the script ends.

                  Comment


                    #24
                    Re: Remove all but the most current records

                    Rich,

                    A summarize operation is 1 way to do it, but you can do it even easier using a filter expression that says essentially

                    ' for character Ticknum
                    datefield==tablemax(tablename,"ticknum='"+ticknum+"'","datefield")

                    ' for numeric Ticknum
                    datefield==tablemax(tablename,"ticknum="+ltrim(str(ticknum)),"datefield")

                    If you create the correct ticknum index, it will use LQO and be pretty fast.

                    Other choices include using DBMAX() instead of TableMax().
                    You could also use LOOKUPx("C".....) on an index with ticknum+invert(cdate(datefield)) to run even faster
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                      #25
                      Re: Remove all but the most current records

                      Originally posted by Tom Cone Jr View Post
                      Tim, I like your script. Suggest a comment on the delete to remind yourself and others that Alpha Five will automatically fetch the next record after doing the delete. I also think it's prudent to close the table when the script ends.
                      Hi Tom,

                      I agree about the t.close() and normally do, just forgot this time. :o

                      Also a good point about highlighting the fact that the t.delete() automatically sets the record pointer to the next record. Its to late to edit my post so I've done it here.
                      Tim Kiebert
                      Eagle Creek Citrus
                      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                      Comment


                        #26
                        Re: Remove all but the most current records

                        Originally posted by Tim Kiebert View Post
                        Gabe,

                        I hadn't looked at the form in your example but now I see you had started to make the same script I did. :)
                        What a coincidence! it's exactly the same.

                        Comment


                          #27
                          Re: Remove all but the most current records

                          Originally posted by G Gabriel View Post
                          What a coincidence! it's exactly the same.
                          Great minds think a like .... forget about the rest.
                          Well, I'll say it is similar conceptually but I don't think I can be accused of copy and paste. ;) Take note of the emphasis in my last post.
                          Tim Kiebert
                          Eagle Creek Citrus
                          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                          Comment


                            #28
                            Re: Remove all but the most current records

                            No accusation.. I must have been hanging around you long enough, your ideas are starting to rub on me..

                            Comment


                              #29
                              Re: Remove all but the most current records

                              "and the hits just keep on comin'" ......................

                              Hey Tim that little xbasic script you wrote works like a champ. I like it because as you said, I don't have to create a separate table with all those funny field names.

                              Once again, Mucho Gracias.
                              Sergeant Richard Hartnett
                              Hyattsville City Police Department
                              Maryland

                              Comment


                                #30
                                Re: Remove all but the most current records

                                No problemo,

                                Just a word of caution.

                                Using the sample you provided and the summary operation or my script the 299 records are reduced to 72. If I apply Ira's filter to the 299 records I get 76 as a result. Examing these 76 I see that a couple of the sec_sub_pa values, (21-1205() and 21-1209()), each have three records with the same date. They have however different N7 values. So not sure if there is a problem with the original data but figured I'd bring it to your attention.
                                Tim Kiebert
                                Eagle Creek Citrus
                                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                                Comment

                                Working...
                                X