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

How do I get original fields values?

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

  • How do I get original fields values?

    How do I reference original field values (i.e. field values before the user changed the values) in an embedded browse... from the cansave event or some/any other event?

    I need to perform some processing, based on the record's "original data," before the user's changes are written.

    Thanks
    "all things should be as simple as possible... but no simpler"

    Mike

  • #2
    Re: How do I get original fields values?

    Check the help on a_field_value.
    There can be only one.

    Comment


    • #3
      Re: How do I get original fields values?

      Thanks Stan...

      I did read about that, but I don't see how it helps me from an embedded browse event? Sorry to be thick about it... but, what am I missing? What event do I/would I use?

      The form has an embedded browse, and when the user changes one of those records... I need the original values for a number of the fields they may have changed.
      "all things should be as simple as possible... but no simpler"

      Mike

      Comment


      • #4
        Re: How do I get original fields values?

        Probably have to use a table record event, CanSaveRecord, and check for the presence/existence of the form in question (IS_OBJECT()).

        Try this as the cansaverecord event code for the invoice_items table in AlphaSports.

        Code:
        if is_object("invoice")
        	ui_msg_box("Alert","Record was saved.",UI_OK)
        end if
        Enter or change a record in the default browse - no message, enter or change a record in the embedded browse on the Invoice form - message.

        Perhaps a better example, put the same code as the canwritefield event for the quantity field and try changing a quantity.
        Last edited by Stan Mathews; 04-09-2010, 10:52 AM.
        There can be only one.

        Comment


        • #5
          Re: How do I get original fields values?

          Thanks Stan... I'll play with/try that.

          I've been trying to figure out:

          <FIELD>.INITIAL_VALUE_GET()

          but, I can't figure out how to reference the field associated with the embedded browse.

          Sure would be a lot easier if Alpha just exposed "value_initial" in addition to "value." :-)
          "all things should be as simple as possible... but no simpler"

          Mike

          Comment


          • #6
            Re: How do I get original fields values?

            The documentation doesn't indicate that .initial_value_get() will work with browse fields.

            The <OBJECT>.FIELD_GET() method applies to:

            Form Controls (for <OBJECT> use the <CONTROL> pointer or the address of the control)
            There can be only one.

            Comment


            • #7
              Re: How do I get original fields values?

              Based on the following from the help:

              ===
              <FIELD>.INITIAL_VALUE_GET()

              Syntax

              Field_Value as A = <FIELD>.INITIAL_VALUE_GET()

              Description

              The <FIELD>.INITIAL_VALUE_GET() method returns the initial value of the field referenced by the <FIELD> object pointer. The initial value is the value before any edits have been made to the field. The type of Field_Value returned depends on the field’s type. Character and memo fields return character strings; date, numeric, and logical fields return values in their corresponding field types.

              This method is useful if you want to determine if the user has changed a field's value when the user edits a record. It is also a way to see if the current record is "dirty", or needs to be saved.

              Supported By

              Alpha Five Version 5 and Above
              ===

              I assumed that if I could get a pointer to the field... Alpha would give me the initial value. I can't understand why they wouldn't... but, if it doesn't... it doesn't. They have, and I can get, the initial record buffer... weird that I can't get a field-worth of it :-)
              "all things should be as simple as possible... but no simpler"

              Mike

              Comment


              • #8
                Re: How do I get original fields values?

                Invoice form in AlphaSports.

                Place this as the onfetch event code for the embedded browse.

                Code:
                dim shared fld_val as c
                fld_val = browse1:description.value
                Place this as the cansave event code for the embedded browse.

                Code:
                dim shared fld_val as c
                if field_changed()
                	ui_msg_box("Initial Value",""+fld_val)
                	ui_msg_box("New Value",""+browse1:description.value)
                end if
                end
                function field_changed() as L
                	init = fld_val
                	final = browse1:description.value
                    if (init <> final) then
                        field_changed = .T.
                    else
                        field_changed = .f.
                    end if
                end function
                Save and change a description.
                There can be only one.

                Comment


                • #9
                  Re: How do I get original fields values?

                  Thanks Stan!

                  When in doubt... be a DIYer :-)
                  "all things should be as simple as possible... but no simpler"

                  Mike

                  Comment


                  • #10
                    Re: How do I get original fields values?

                    Now the cansave event is not firing... sometimes??? Actually, it never seems to fire in a companion form (i.e. a form related to an embedded browse). The onsave event fires, as expected, but not the cansave.

                    What am I missing?
                    "all things should be as simple as possible... but no simpler"

                    Mike

                    Comment


                    • #11
                      Re: How do I get original fields values?

                      I have not tested these form events, but I have found issues with the "table" CanWriteField event when a lookup rule is defined for a field and you are trying to use a_field_value, which is incorrect in some cases.

                      What I am saying is that there is likely a specific reason that the event "occasionally" does not fire. And it could be something you do not expect.

                      I would turn on the debugger and watch values as you step through various events.

                      Bill.

                      Comment


                      • #12
                        Re: How do I get original fields values?

                        Thanks Bill... we are finding it to never work with respect to forms that are called using the "open companion form" feature from an embedded browse. As is typical, I'm sure we have stumbled on some unique set of circumstances and in the end we will find a "work-around."
                        "all things should be as simple as possible... but no simpler"

                        Mike

                        Comment

                        Working...
                        X