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

Invoice Table and Deletes

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

    Invoice Table and Deletes

    I am attaching a test table called Invoice_Test. I have two problems.

    Problem #1: The field Refnumber is a character field and should be the unique reference number of the invoice. I have tried several things in order to get this to sort correctly, all without success. I should be able to do this with the formula alltrim(str(val(alltrim(refnumber)))) which should turn the reference numbers into a proper sort order. The second field I added at the end was to try and help this indexing, but in my real world, I cannot add another field to the table.

    Problem #2: I need to mark, and then delete duplicate entries. The entry that needs to be saved is the one having the latest date which is in the TimeModified field. So, if two invoices have the same reference number, then I want to keep the most current one. I've tried using the Mark duplicate function, but there is no way I see to ensure one record is selected over another.

    I hope this makes sense and someone can help me get started.
    Attached Files

    #2
    Re: Invoice Table and Deletes

    which should turn the reference numbers into a proper sort order
    Please give an example indicating what you think the proper sort order should be.
    There can be only one.

    Comment


      #3
      Re: Invoice Table and Deletes

      You probably want .MARK_DUPS2(). When you use this method you will have all instances of any refnumber that has duplicates.

      Then create an xbasic loop which filters for marked() records, orders the records ascending by refnumber, descending by the timemodified field.
      Capture the current refnumber. Fetch through the table. If the next record has the same refnumber, delete it. If the next record has a different refnumber, capture that and repeat the loop.
      There can be only one.

      Comment


        #4
        Re: Invoice Table and Deletes

        OK. That sounds good Stan. Hopefully it will give me a start. But in order to get going I need to order the table properly. By "properly" I mean numeric type order, such as 107, 108, 1008, 1009A, 11000, etc. I'm not getting that with my code and can't figure out why.

        Comment


          #5
          Re: Invoice Table and Deletes

          Originally posted by Charles Hoens View Post
          OK. That sounds good Stan. Hopefully it will give me a start. But in order to get going I need to order the table properly. By "properly" I mean numeric type order, such as 107, 108, 1008, 1009A, 11000, etc. I'm not getting that with my code and can't figure out why.
          Once you've run the code you need to sort on the new field.

          Since there are alpha numeric characters in your Refnumber field, your code will strip those non-numerics out. That may not be a good idea.

          What you really want to do is get these values right justified in the column. Currently they are left justified.

          I'm guessing that you are getting this data from some other data source?
          Al Buchholz
          Bookwood Systems, LTD
          Weekly QReportBuilder Webinars Thursday 1 pm CST

          Occam's Razor - KISS
          Normalize till it hurts - De-normalize till it works.
          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
          When we triage a problem it is much easier to read sample systems than to read a mind.
          "Make it as simple as possible, but not simpler."
          Albert Einstein

          http://www.iadn.com/images/media/iadn_member.png

          Comment


            #6
            Re: Invoice Table and Deletes

            change your refcheck field to character and make the field rule calculated to - PADL((""+VAL(REFNUMBER)),11,"0") and you will be able to sort the records based on that field easily.
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Invoice Table and Deletes

              I'm unclear why the refcheck field is needed to find duplicates? Can't you achieve your results using the trimmed values in the refnumber field?

              Comment


                #8
                Re: Invoice Table and Deletes

                Al. Thanks. I'm getting it out of QuickBooks.

                Tom. I put the refcheck field into this test in order to try and solve the initial problem. But in the actual download table it would be a problem, so I need to know how to sort the refnumber field. If that is solved, then I can handle the rest. (I hope....famous last words!)

                Mike - That worked perfectly and I think the rest will now fall into place. Thanks so much!!!
                Last edited by Charles Hoens; 06-25-2014, 12:18 PM. Reason: Forgot to thank Mike!

                Comment


                  #9
                  Re: Invoice Table and Deletes

                  Try Mike's suggestion but just sort the table on

                  padl(alltrim(refnumber),11," ")

                  no calculated field needed.

                  Probably what Al was alluding to doing.

                  For the mark_dups2(), since you're just looking to delete duplicates, you can merely sort on refnumber. That will put duplicates next to each other.
                  There can be only one.

                  Comment


                    #10
                    Re: Invoice Table and Deletes

                    If this data is being brought over from Quickbooks, why are there dupes? Seems you might need a way to catch that before it happens...
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                      #11
                      Re: Invoice Table and Deletes

                      Well, that's an issue. They are truly dupes. I'm using QODBC to download the data and because of what data I need, I have to use one particular file. Unfortunately, the dupes come into play as every once in a while an update to a particular invoice is made in the system. I then need to run this routine to identify them and then save the latest iteration. Invoice numbers are not duplicated inside QuickBooks.

                      Comment


                        #12
                        Re: Invoice Table and Deletes

                        Originally posted by Charles Hoens View Post
                        Well, that's an issue. They are truly dupes. I'm using QODBC to download the data and because of what data I need, I have to use one particular file. Unfortunately, the dupes come into play as every once in a while an update to a particular invoice is made in the system. I then need to run this routine to identify them and then save the latest iteration. Invoice numbers are not duplicated inside QuickBooks.
                        I figured it is QuickBooks data.

                        I know that this company file has the QuickBooks auditing turned on. So you are seeing the original transaction and each modified transaction.

                        So you want to use the txnid and the editsequence to determine which txnid is the latest.

                        The refnumber is relatively useless for this type of deduping.

                        You'll need to the add the editsequence field to your table.
                        Al Buchholz
                        Bookwood Systems, LTD
                        Weekly QReportBuilder Webinars Thursday 1 pm CST

                        Occam's Razor - KISS
                        Normalize till it hurts - De-normalize till it works.
                        Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                        When we triage a problem it is much easier to read sample systems than to read a mind.
                        "Make it as simple as possible, but not simpler."
                        Albert Einstein

                        http://www.iadn.com/images/media/iadn_member.png

                        Comment


                          #13
                          Re: Invoice Table and Deletes

                          Hmmm. Thanks Al for looking this problem over. Just so you know, I am using the InvoiceLine table. I've also added a lot of other data into the QB invoice, which allows me to see what kind of service is being performed and then add all that up in A5. But I still don't understand. The refnumber is the Invoice number, so how does looking at the txnid or the editsequence help me?

                          I can send you the Invoiceline file if that might help is sorting this out.

                          Thanks!

                          Comment


                            #14
                            Re: Invoice Table and Deletes

                            Originally posted by Charles Hoens View Post
                            Hmmm. Thanks Al for looking this problem over. Just so you know, I am using the InvoiceLine table. I've also added a lot of other data into the QB invoice, which allows me to see what kind of service is being performed and then add all that up in A5. But I still don't understand. The refnumber is the Invoice number, so how does looking at the txnid or the editsequence help me?

                            I can send you the Invoiceline file if that might help is sorting this out.

                            Thanks!

                            Actually the complete invoice and invoiceline table would help. And a lot more information about what the app is supposed to do.

                            Please email me to discuss.

                            [email protected]
                            Al Buchholz
                            Bookwood Systems, LTD
                            Weekly QReportBuilder Webinars Thursday 1 pm CST

                            Occam's Razor - KISS
                            Normalize till it hurts - De-normalize till it works.
                            Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                            When we triage a problem it is much easier to read sample systems than to read a mind.
                            "Make it as simple as possible, but not simpler."
                            Albert Einstein

                            http://www.iadn.com/images/media/iadn_member.png

                            Comment


                              #15
                              Re: Invoice Table and Deletes

                              Originally posted by Charles Hoens View Post
                              Just so you know, I am using the InvoiceLine table. I

                              Thanks!
                              Actually nothing previously posted indicated the invoiceline table. But after further review there is a record in invoiceLINE for each line in an invoice. Including comments and blanks lines. So having 'duplicate' invoice numbers is not a sign of a problem, but of multiple lines on an invoice.

                              Do you find duplication in the invoice table where there is only one record per invoice (unless auditing is turned on and changes are made to an invoice)?
                              Al Buchholz
                              Bookwood Systems, LTD
                              Weekly QReportBuilder Webinars Thursday 1 pm CST

                              Occam's Razor - KISS
                              Normalize till it hurts - De-normalize till it works.
                              Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                              When we triage a problem it is much easier to read sample systems than to read a mind.
                              "Make it as simple as possible, but not simpler."
                              Albert Einstein

                              http://www.iadn.com/images/media/iadn_member.png

                              Comment

                              Working...
                              X