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

Deleting All Invoice Records

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

    Deleting All Invoice Records

    Hi,

    I'm using a routine to delete all current Invoice records, but it is deleting all records in the invoice items files: Here's the code, as I'm sure I'm doing something stupid:

    'Date Created: 14-Sep-2009 09:49:00 PM
    'Last Updated: 14-Sep-2009 09:57:25 PM
    'Created By : TRACS
    'Updated By : TRACS
    dim my_id as c

    dim tbl as p
    tbl = table.current()
    my_id = tbl.invoice_number 'get current invoice number

    tbl=table.open("invoice_items")
    tbl.index_primary_put("invoice_number") ' assumes index
    tbl.fetch_find(my_id) ' go to first of line items

    while tbl.invoice_number = my_id .AND. .not. tbl.fetch_eof()
    tbl.change_begin()
    tbl.delete()
    tbl.change_end(.t.)
    tbl.fetch_next()
    end while

    tbl.close()
    topparent.resynch()

    Thanks Ryland

    #2
    Re: Deleting All Invoice Records

    You have a table pointer reuse issue. Better practice is

    Code:
    [COLOR="Blue"]parentform.commit() 'make sure we are not in change or enter mode[/COLOR]
    dim my_id as c
    
    dim tbl as p 
    tbl = table.current()
    my_id = tbl.invoice_number 'get current invoice number
    
    [COLOR="Red"]itms[/COLOR]tbl=table.open("invoice_items") 
    [COLOR="red"]itms[/COLOR]tbl.index_primary_put("invoice_number") ' assumes index
    [COLOR="red"]itms[/COLOR]tbl.fetch_find(my_id) ' go to first of line items
    
    while [COLOR="red"]itms[/COLOR]tbl.invoice_number = my_id .AND. .not. [COLOR="red"]itms[/COLOR]tbl.fetch_eof()
    [COLOR="red"]itms[/COLOR]tbl.change_begin() 
    [COLOR="red"]itms[/COLOR]tbl.delete() 
    [COLOR="red"]itms[/COLOR]tbl.change_end(.t.) 
    [COLOR="red"]itms[/COLOR]tbl.fetch_next()
    end while
    
    itmstbl.close() 
    topparent.resynch()
    There can be only one.

    Comment


      #3
      Re: Deleting All Invoice Records

      Thanks Stan,

      It appears that the routine is deleting the header as well. Actually, I want to retain the Invoice header as an audir train, but just remove the "invoice Items" themselves. The routine alos seems only to delet the last line item, and not all of them.

      Ryland

      Comment


        #4
        Re: Deleting All Invoice Records

        Originally posted by [email protected] View Post
        It appears that the routine is deleting the header as well.
        The suggested change shouldn't delete any records in the header table so long as the header table is not invoice_items.

        To ensure that all line items are processed we should probably go to the top of the table first.

        Code:
        parentform.commit() 'make sure we are not in change or enter mode
        dim my_id as c
        
        dim tbl as p 
        tbl = table.current()
        my_id = tbl.invoice_number 'get current invoice number
        
        itmstbl=table.open("invoice_items") 
        itmstbl.index_primary_put("invoice_number") ' assumes index
        [COLOR="Red"]itmstbl.fetch_first()[/COLOR]
        itmstbl.fetch_find(my_id) 
        while itmstbl.invoice_number = my_id .AND. .not. itmstbl.fetch_eof()
        itmstbl.change_begin() 
        itmstbl.delete() 
        itmstbl.change_end(.t.) 
        itmstbl.fetch_next()
        end while
        
        itmstbl.close() 
        topparent.resynch()
        There can be only one.

        Comment


          #5
          Re: Deleting All Invoice Records

          When deleting records in a loop you don't need to use itmstbl.fetch_next().
          If you had enough records to see, you would probably notice that every other record is being deleted. When the active record gets deleted the table pointer is moved to the next record.
          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


            #6
            Re: Deleting All Invoice Records

            Hi Stan / Tim

            I copied the code into an inline basic script, but it will only delete one record when run, then no others. I'm not in enter mode, and the Header record is intact which is good. I also commented out the fetch next, but that did not work either. Could I be missing something else ??

            Thanks,

            Ryland

            Comment


              #7
              Re: Deleting All Invoice Records

              Yes. Time to show us your revised script. :)

              Comment


                #8
                Re: Deleting All Invoice Records

                OK will zip some files up and send to ya'll. On the train commuting and keep losing signal, Thanks

                Comment


                  #9
                  Re: Deleting All Invoice Records

                  The index you are using wouldn't by any chance be set to 'unique only' instead of 'all' would it.

                  Failing that we may need to see a sample.
                  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


                    #10
                    Re: Deleting All Invoice Records

                    Originally posted by Tim Kiebert View Post
                    Failing that we may need to see a sample.
                    Woops. A bit slow I see. :)
                    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


                      #11
                      Re: Deleting All Invoice Records

                      Hi,

                      Attached is the zip file. Go to Forms in the control panel, and select the TRACS Management. From there, select the Tool Issue, enter 123456 as the login and hit enter .

                      A simular screen appears like AlphaSports. You will see a Delete Button in the middle of the screen that I'm testing with for the Delete all line items. There should be plenty of stock in the dropdown for the product numbers.

                      Comment


                        #12
                        Re: Deleting All Invoice Records

                        Your app is misbehaving under V8 and I haven't installed v9 yet. Can't close/save the invoice_issue_new form without Alpha closing and corrupting the form.

                        Someone else will help, I'm sure.
                        There can be only one.

                        Comment


                          #13
                          Re: Deleting All Invoice Records

                          Thanks Stan,

                          Sometimes I just add the system menu to the properties so I can individually close windows that I'm working on. I this way it should not kick you out of the application,,,Ryland

                          Comment


                            #14
                            Re: Deleting All Invoice Records

                            Ryland, your instructions are incomplete and lead to error messages. Can't log in using vers 9.

                            Comment


                              #15
                              Re: Deleting All Invoice Records

                              Humm, I zipped the file, but what I did was disable the Autoexec that ran the Main Menu.

                              From the form tab, If you run the Main Menu, that is where all the variables also get set. So from the main menu:

                              1 - enter the scan id "rsw123" and hit enter.
                              2 - that will bring up the second menu "TRACS Management"
                              3 - select the "tool issue" and use "123456" and hit enter, and that should take you into the tool issue screen.

                              The only errors that should be there in the version 9 is just the picture files. Other than that, then I'll have to cut a full release. Sorry that ya'll are having probllem.Ryland

                              Comment

                              Working...
                              X