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

On Save Event not firing

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

    On Save Event not firing

    Need a little help. I have a form which appends a record to another table on the condition that the field <Status> = "Gone" and the field <Commission> = .T.

    Now, if I enter a record in the form with <Status> = "Normal" and save it, then go back and change <Status> to "GONE", the ONSAVE event fires and the record gets appended. But, if I enter a record with <Status> = "Gone" and save it, the ONSAVE event doesn't fire and the record does not get appended unless I go back and edit the record and then save it again.

    I have tried the CANSAVE Event but that didn't seem to work either. What am I missing?

    Is there another way to append just the record that is open at the time instead of running an append operation and checking every record in the transaction table?
    Last edited by Beltronics; 06-02-2009, 08:42 PM. Reason: Second Question
    Jim Belanger

    #2
    Re: On Save Event not firing

    Can't really answer your questions without seeing the script that runs the append operation, and without seeing the append operation's definition. Sample tables and your form would help, too.

    If you had a Save button the user had to push in order to save the current record, that button could open the other table and enter a new record quite easily.

    Running a saved Append operation to enter a single record is overkill, in my opinion.

    BTW, Have you considered the effect of your sequence if the user edits / appends, then edits to "normal", then edits / appends again. Won't you wind up with an unwanted duplicate in your target table?

    -- tom

    Comment


      #3
      Re: On Save Event not firing

      Hi Tom and thanks for the info.
      No, I don't end up with a duplicate since I only append Unique, replace existing. So, any change to the record appends a new record and overwrites the existing one. The append operation works like a charm if I save the record during an edit operation but not in the initial enter operation.

      The append operation is pretty straight forward. In the action script, it is an append "Unique, replace existing". The Master table is a commissionsales.dbf, linking key is "invoice", Transaction table is a repairs.dbf. Filter for the transaction is [Status = "Gone".and.Commission_Sale=.T.]

      I may try to work out an xbasic code operation to simply add a record to the table but I have to figure that one out. I know an append that goes thru the entire table is a long way around but I don't see an action script option to add one single record to another table.

      I do have a "SAVE" button on the form which the operator clicks on to save the record but, for some reason unknown to me, it needs to be clicked twice before it saves the record. It simply is set up ON Push it executes the menu command "Record|Save Record".
      Jim Belanger

      Comment


        #4
        Re: On Save Event not firing

        Ok, Jim. Good luck with your project. -- tom

        Comment


          #5
          Re: On Save Event not firing

          Originally posted by Beltronics View Post
          I don't see an action script option to add one single record to another table.
          Maybe time to dip your toes in the xbasic pool? The xbasic example for .Copy_record_To() sound like what you want.

          Eliminate one line (in red here) and it should copy the current record to the named table.


          Code:
          dim tbl as P
          tbl_source = table.current()
          [COLOR="Red"]tbl_source.fetch_goto(3)[/COLOR]
          on error goto failed_to_copy
          result = tbl_source.copy_record_to("[COLOR="Blue"]OLD_CUSTOMERS[/COLOR]")
          on error goto 0
          if result then
              ui_msg_box("Result","Record was copied")
          end if
          end
          failed_to_copy:
              ui_msg_box("Record not copied.", error_text_get(error_code_get()))
          end
          There can be only one.

          Comment


            #6
            Re: On Save Event not firing

            Thanks Stan. A place to start anyway. Not sure I follow it thru but I'll give it a whirl. If I run into trouble, I'll post again. It won't be for a bit though so stand by!!
            Jim Belanger

            Comment


              #7
              Re: On Save Event not firing

              Stan
              I don't want to copy the entire record, only some of the fields.
              I'll keep working on it.
              Jim Belanger

              Comment


                #8
                Re: On Save Event not firing

                Action Script Get Field Values (into Variables)
                Action Script Enter a New Record
                Action Script Xbasic Change Record
                There can be only one.

                Comment


                  #9
                  Re: On Save Event not firing

                  Stan and Tom,

                  Here I am trying to figure a way around this problem and I may end up having to set up a test database to send someone to look at BUT, the thought struck me last night. WHY? I may not be an expert at Xbasic but I'm not a complete dummy when it comes to Alpha. So, why is this not working. I set up this routine to append a record to a new table (even though it's overkill) in 2003 and it's been working fine. Now, I have a problem and I'm looking at the oldest date when this started happening. My oldest "missed append" was on or about June 16, 2008. So, what upgrade to Alpha did I install in June 2008 that made this perfectly fine routine start messing up? It worked for 5 years and stopped working 100% a year ago. Instead of wracking my brain to figure a work around, maybe I should try and find the upgrade that caused it?? I'll keep you posted.
                  Jim Belanger

                  Comment


                    #10
                    Re: On Save Event not firing

                    Jim,
                    My question is why spend needless hours searching for something that may not exist? So when you find it ... what then? I say...don't bother. Make an example with the source and target tables, which fields you want copied and post it and in a few minutes you will get a solution without the search and rescue mission that you have decided is (not) in order. Move forward, not backwards.
                    Code:
                    It simply is set up ON Push it executes the menu command "Record|Save Record".
                    Why use a menu command? I have found these finicky. Why not use what is the simplest:
                    Code:
                    topparent.commit()
                    Last edited by Mike Wilson; 06-04-2009, 10:27 AM.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: On Save Event not firing

                      The “Operation” described below was set up in 2003 and worked fine. It may not be the best way to do what I want but for a non Xbasic programmer, it worked for me. Lately, we found missing records that should have been in the table “nucommsales” and were not. Looking at the missing records, the earliest was June 16, 2008. So, this process worked from sometime in 2003 until June 2008 when it started missing some “appends”.

                      ---------------------------------------

                      Start the database named Btronics.adb

                      Menu should open. In order to close menu form, you need to click on the small lock icon to the left of the Menu page title. password beltv1968

                      1. Click on tab, Data Entry
                      2. Click on "Work Order"
                      3. Enter a new work order.

                      Customer; Belanger, James
                      Invoice # (make up any number, 0003 would be fine).
                      Staff person should be "Dan Griffin"
                      Click "Commission Sale" so an "X" appears.
                      Save the record.

                      Go to Control Panel

                      Double click table "Nucommsales"

                      The invoice you just entered should be there, it isn't. ONSAVE event fires operation "addcomm" which should have added the record from the work order to nucommsales.

                      Go back to the work order you just entered. Edit it, edit any field - for example, change NH to VT and back to NH and save the record.

                      Go back to control panel, open Nucommsales and now your record has been added.

                      Now, if you entered the work order as “Normal” and not “Gone” and saved it. Then went in and edited the record to show “Gone”, then it appended OK. It just does not append the record ONSAVE if you enter “Gone” initially.

                      To see control panel, click on the Lock icon and enter the password.
                      Last edited by Beltronics; 06-04-2009, 03:27 PM. Reason: password
                      Jim Belanger

                      Comment


                        #12
                        Re: On Save Event not firing

                        Sorry Jim,
                        I can't follow. I don't see a tab "Data Entry". To be honest, when the form first opens... there are no tabs at all until a button is pressed and the form seems to refresh.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: On Save Event not firing

                          I have complained to Alpha about those disappearing tabs for a year now. If you use the Alpha upgrade without the NEW BROWSE the tabs are always there. If you use the latest version with the NEW BROWSE, the tabs are gone until you click in an area where they are SUPPOSED to be.

                          Depending on which version you have, you should have a tab called Data Entry, then a button called Work Order.

                          The later version has a tab named Work,
                          Then a button named Work (Service) Order.
                          Jim Belanger

                          Comment


                            #14
                            Re: On Save Event not firing

                            Jim

                            I had the same problem with tabs not showing. Try this: in design mode of your tabbed object, right click and go to Order. Select "to front" and save. This worked with your database on my system (V9 with New Browse).
                            Cliff

                            Coffee tastes better if the latrines are dug downstream from an encampment.
                            - US Army Field Regulations, 1861

                            Comment


                              #15
                              Re: On Save Event not firing

                              Wow Cliff

                              Alpha has been working on this "bug" for over 6 months and has not come up with a solution. Thank you very much.
                              Jim Belanger

                              Comment

                              Working...
                              X