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

Form "Dirty" property?

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

    Form "Dirty" property?

    Is there a property that indicates if a user has changed something about a record on a form? In Microsoft Access this is the "dirty" property. I searched the forums and it appears A5v6 had such a thing (?) but I can't find it in the Help file for A5v7.

    Thanks,
    TD

    #2
    Re: Form "Dirty" property?

    TD, if the user changes a field value in the current record the "mode" of the form changes to "CHANGE" (or "ENTER" if it's a new record). Your scripts can retrieve the current mode of the form and branch accordingly.

    Comment


      #3
      Re: Form "Dirty" property?

      Originally posted by dodgebros View Post
      Is there a property that indicates if a user has changed something about a record on a form? In Microsoft Access this is the "dirty" property. I searched the forums and it appears A5v6 had such a thing (?) but I can't find it in the Help file for A5v7.

      Thanks,
      TD
      .set_dirty()
      There can be only one.

      Comment


        #4
        Re: Form "Dirty" property?

        Hi TD,

        I think a little clarification of the following would help:

        changed something about a record on a form
        The dirty function that Stan has so kindly provided you the link for indicates that the layout has changed and needs to be saved. This will work if you are concerned about others making modifications to your actual forms.

        If you are talking about tracking when an actual record is changed, then Tom has the right idea. Unfortunately, in order to give you more in depth assistance with Tom's idea, we would need to know more of what you are trying to do.

        Are you looking to track when changes are made to a record? If so, what kind of info do you need (date,time,user,actual data before and after)?

        Do you simply want to know when a record is actually in change mode? This would be what Tom is referencing (I think).

        Do you want to limit changes that can be made to records somehow?

        Please give us more details of exactly what you are trying to accomplish if the link that Stan provided for you does not resolve your issue.

        Good luck
        Cheryl
        #1 Designs By Pagecrazy
        http://pagecrazy.com/

        Comment


          #5
          Re: Form "Dirty" property?

          Do you simply want to know when a record is actually in change mode? This would be what Tom is referencing (I think).
          Hi Cheryl. I just want to know if the user has changed any value in any field on the form so I can throw up my own "Do you want to save changes?" message box if they have and are closing the form or just close the form if they haven't changed anything.. I think Tom's is the correct solution. However, being new to A5v7 I'm not sure how to determine what mode the form is in.

          Thanks,
          TD

          Comment


            #6
            Re: Form "Dirty" property?

            Hi TD,

            What you want to accomplish is doable, but would require programming. I use custom toolbars on my data entry forms and lock them down so that I am controlling the data entry. I learned this from Tom many years ago and have used it ever since.

            I have my own add/edit/delete buttons on the form. When the user selects any of those, the buttons are hidden and a save changes and cancel changes buttons appear in their place. I even have a 'text' object on the form letting the users know that they are 'viewing', 'editing', or 'entering' modes.

            You could take this a step further if you wanted to and when the user clicks on YOUR edit button, you display a message that asks them if they are sure they want to continue.

            Getting the mode of the form: parentform.mode_get()

            http://support.alphasoftware.com/alphafivehelpv8/Methods/_OBJECT_.MODE_GET().htm

            Good luck
            Cheryl
            #1 Designs By Pagecrazy
            http://pagecrazy.com/

            Comment


              #7
              Re: Form "Dirty" property?

              Hello TD,

              Check out the FieldPointer.initial_value_get() and the FieldPointer.value_get() methods. These would allow you to roll your own. You could use the formPointer.child_enum() method with a flag to loop through all the field objects and check to see if any had been changed. You can also check out the system variable a_field_value, but I wouldn't use it in this context.

              I'm not aware of a already built-in function that does this for you. The normal operation of a form in Alpha exibits the behavior you are describing so the functionality you desire is already there, but maybe Alpha has not exposed it to us because it is default behavior. But pretty simple to build your own.

              Good luck,
              Jim

              Comment


                #8
                Re: Form "Dirty" property?

                Hello, Jim.

                The help file topic "Determining if a Record Has Been Changed" illustrates another (easier?) way to roll your own using the "property_to_string()" function. If you pass a table pointer to the function it will create a string equivalent for the current record. Do this when the form fetches a record, and then again before the form closes, then compare the two strings. If they match no change was made by the user.

                Your point about this already being "built-in" is a good one. Alpha will warn you if you're closing the form and unsaved changes are pending.

                Comment


                  #9
                  Re: Form "Dirty" property?

                  Thanks for all of the suggestions. I'll check these out and let you know what I decided to do.

                  TD

                  Comment


                    #10
                    Re: Form "Dirty" property?

                    TD,

                    As a last resort, there is one other alternative. When you attempt to customize the system "Form view" toolbar and look at what enables the Save icon, you will find the expression:
                    Code:
                    'E'$topparent.command('?RECORD_COMMIT')
                    That expression is .T. or .F. depending on whether the record has been changed. Apparently, this topparent.command() has a value of "E" or "D" depending on whether the current record has been changed. Again, there are other alternatives and this should maybe be considered a last resort since it uses an internal command.

                    Steve

                    Comment


                      #11
                      Re: Form "Dirty" property?

                      TD,

                      I was asked and complied for a log file by a customer.

                      This log file is a dbf and with a little code, it now gets filled when a user signs in and out, when he enters or leaves a form and soon it will log if he changes certain fields that are necessary to keep correct.
                      Acct Numeric 8 0
                      Date Date 8 0
                      Timing Character 20 0
                      Action Character 50 0
                      User Character 50 0
                      the action goes something like this.
                      this is run on the onsave event at form level.
                      Code:
                      ' i have an action script that reads teh proper fields into vars before this.  You could make the tables better for yo and include more fields.
                       
                      tbl=table.open("logs",FILE_RW_SHARED)
                      tbl.enter_begin()
                      tbl.date = date()
                      tbl.acct = var->theacct
                      tbl.Timing = time("0h:0m:sA")
                      tbl.user = var->scode
                      tbl.action = "Saved Record "
                      tbl.enter_end(.t.)
                      table.close()
                      Hope it helps in some way.

                      dave
                      Dave Mason
                      [email protected]
                      Skype is dave.mason46

                      Comment

                      Working...
                      X