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



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

Other choices of "Initial Value" of a field.

  • Filter
  • Time
  • Show
Clear All
new posts

    Other choices of "Initial Value" of a field.

    A5V11 allows the initial value of a field to be sepcified as a constant, e.g. =abc, the result of a function, e.g. =date(), or major variables like session or page variables.

    However, can it be initialized as the previously saved value? and what is the syntax?
    Or is there a way to simply not clear it and leave the previous value there? (in my version of A5V11, even when this [initial value] field is not specified as NULL, i.e. empty, the field is still cleared when new record entry is in effect).

    Re: Other choices of "Initial Value" of a field.

    Would this video help? It's M8


      Re: Other choices of "Initial Value" of a field.

      Thanks for posting that David, that may be what i have been looking for.

      Not to complain, well maybe a little, but I have noticed some videos, including this one, cuts off some of the code needed to make it work. The last part of the video does not show all of the code to the right of the screen and the narrarator never scrolls over to show it. Most users will know what is missing, but not all of us do, so it is a guessing game. I also wonder why Alpha cannot include a text file containing the code beside the video link. That would save time and mistakes trying to re-write the code.
      Epigate Software, LLC.

      [email protected]


        Re: Other choices of "Initial Value" of a field.

        Firstly, I echo what JR had to say.

        Secondly, I have reviewed M8 a couple of times. I felt that this approach is good for the grid view and something similar can be done for the detailed view. However, I am looking for a solution without coding (I prefer no coding whenever possible), and without having to do round trip between server and client.
        It seems that the initial value property of a field in the Detailed View can do the job, if I can only set it to the value of the previous entry of the same field (similar functionality as depicted in M8). Is this possible?


          Re: Other choices of "Initial Value" of a field.

          David and any A5 guru,

          I am getting really close now. I used this event handler for my Detailed View. According to the M8 video, the e.dataSubmitted.XXX variable stores the value of the field just submitted. So I set the new value of my Note field to this submitted value. However, Alpha complaint that the e.dataSubmitted subelement is not found. Why is that?? Thanks for any help offered.

          function onInitialValueCalculate as v (e as p)
          'This event fires before the New Record rows are displayed. It allows you to compute initial values for fields in the Grid.

          e.newValues.Note = e.dataSubmitted.Note

          end function


            Re: Other choices of "Initial Value" of a field.

            I don't think the no coding thing is quite here yet... besides... c'mon... this is fun. Anyway... e.dataSubmitted doesn't exist in the onInitalValueCalculate event - thus the error. However... you are close. Since e.newValues can take a variable - let's give it one.

            In Grid OnGridIntialize put this...

            Session.lastSavedValue = ""
            We're setting up a session variable to use later. There may be a way to test for a variable's existence, so we don't have to do this... have to go look for that... I keep forgetting... but, for now, it's ok.

            Next, in the Grid AfterInsertRecord event, this...

            Session.lastSavedValue = e.DataSubmitted.ProdPrice
            Here we're assigning the submitted value of the field - to the session variable.

            Finally, in the onInitalValueCalculate event...

            e.newValues.prodprice = Session.lastSavedValue
            Now, any new row field will have the last saved value of that field. Seems to work pretty good. Any very little coding :)

            You could do this all on the client side too... so no server involvement. Back with that in a bit.


              Re: Other choices of "Initial Value" of a field.

              Thanks for the reply David,

              It is so close now.
              I did what you suggested, but still no luck (the field was blank). I then set the Session.lastSavedValue to "session" for OnGridInitialize just to test it, ran it again, then the initial value appears as 'session', which tells me that AfterInsertRecord seemed never fired.

              Is my suspecion correct? and if so, why didn't it fire?
              I am beginning to wonder whether this approach is applicable to the DetailView entries?

              Also, I prefer the client side approach if at all possible. Look forward to your next words of wisdom.


                Re: Other choices of "Initial Value" of a field.

                For Client side, Javascript only, you could do this...

                In the Field, onChange event...

                window['wvarLastValue'] = {grid.Object}.getValue('G','ORDNAME',{Grid.RowNumber});
                In the Grid, Client side events, afterRowPopulate...

                var rowNum = {Grid.Object}._selectedRow;
                var rowNum = {Grid.Object}._selectedRow;
                if(typeof window['wvarLastValue'] != 'undefined') 
                For Detail View it depends on how your getting the detail. Is it the built-in detail view, or a detail view Grid you're linking to?
                Last edited by Davidk; 04-13-2012, 05:27 PM.


                  Re: Other choices of "Initial Value" of a field.

                  Thank you very much. I will chew on them.


                    Re: Other choices of "Initial Value" of a field.

                    For a built-in Detail View, you can use something that Selwyn touches on in the M8 video. He reports that you cannot use OnInitialValueCalculate, in a Grid, because it only gets fired once... when the Grid is first displayed. He does say, however, that it fires each time a new record is requested in a Detail View.

                    So, set up a session variable, as previously noted, in the OnGridInitialize event.

                    Session.newDetailValue = ""
                    In the AfterInsertRecord event...

                    Session.newDetailValue = e.DataSubmitted.TestData
                    And, in the OnInitialValueCalculate event...

                    e.newValues.TestData = Session.newDetailValue


                      Re: Other choices of "Initial Value" of a field.


                      We are so close. I did exactly what you suggested, but AfterInsertRecord didn't seem to fire, so the field is left blank. To prove that, I set the Session variable to "Initialized" instead of "". Then, the new records showed a default value of "Initialized" instead of the last submitted value.

                      To prove further, I set the same session variable in AfterInsertRecord to "AfterInsert". Still, the field remains "Initialized".

                      It is puzzling why AfterInsertRecord didn't seem to fire (after the save icon is clicked to submit the DetailView data)??


                        Re: Other choices of "Initial Value" of a field.

                        Interesting finding:

                        Upon further trials, I found that AfterUpdateRecord is the event got fired. So, if I put the assignment statement in this event rather than AfterInserReord event, then use the "Save and enter New Record" button to enter a new record, then the prior value will correctly show up in the field as default value of the new entry.

                        A partial success, but still don't know exactly what action triggers the AfterInsertRecord event.


                          Re: Other choices of "Initial Value" of a field.

                          I guess you'd need both. If you're adding a new record then AfterInsertRecord should fire and if you're just updating information then AfterUpdateRecord will fire. Put the Session var in both and you should be covered.


                            Re: Other choices of "Initial Value" of a field.

                            Upon furhter debugging, I found some very interesting subtlety about afterInsertRecord Event, perhaps related to the difference between the Grid view actions and the Detailed view actions.

                            1. When the "save" button, on the DetailView, is clicked, afterUpdateRecord Event is fired. (expected)
                            2. When the "save and enter new record" button, on the DetailView, is clicked, afterUpdateRecord and afterInsertRecord Event are fired. (expected)
                            3. When the "new record" button, on the Grid View, is clicked, afterInserRecord Event is not fired. (Unexpected)

                            The question is about #3. Why? Is this is designed feature, or ??
                            (latest finding for #3, afterInserRecord event did fire, when doing a live preview on a broswer. It seemed not to fire when using the working preview)

                            Last edited by Delta Force; 04-14-2012, 09:13 PM. Reason: added latest finding.


                              Re: Other choices of "Initial Value" of a field.

                              This post is no longer needed.
                              Last edited by Delta Force; 04-14-2012, 09:13 PM.