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

View the All Script in ONE PAGE

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

    View the All Script in ONE PAGE

    Hi

    I have created a form with 5 button and few fields. I have entered the script for each of the button and the script when the user open the form.

    I have copied this form to other table, I need to change one by one of the script, it takes time.

    Is there any way to view all the script in one page?

    In Access Program, I can view all the coding in one page and easy for me to maintenace it and change it.

    Please advice. Many thanks.

    #2
    Re: View the All Script in ONE PAGE

    The simplest way to do this is to always create, save and name your scripts in the code editor.

    If you save a script as "FormName_OnInit" (substituting the form name) then you can invoke the script by putting the form in design mode, events, on init and, in the code box call the script with
    script_play("FormName_OnInit")
    or whatever you have named the script. In the same way you can place script_play() commands on a button or any other location where code can be run. Script names should obviously reflect the location and function.

    In this way you can have scripts open in the code editor and test code endlessly while making code changes without ever opening a form, browse or other layout in design mode.

    In the case you ask about, the will have the same name in each form location after you copy the form. You can leave the script names the same and modify the code in each script to accommodate the different form location. One script could then run in many locations.
    Finian

    Comment


      #3
      Re: View the All Script in ONE PAGE

      A little more advanced method would be using a goto in your coding for the script
      Code:
      as in: select
                  case var->xxx = init then goto init
                       where init: would go to the code for init:
                  case var->buttonx
                       where buttonx would go to the code marked buttonx:
      end case
      
      'your init would set the variable xxx to whatever you chose to make this code work and start the script
      'your button would only set the var and start the script
      Hope this helps you.

      Dave
      Last edited by DaveM; 06-09-2007, 01:17 PM.
      Dave Mason
      [email protected]
      Skype is dave.mason46

      Comment


        #4
        Re: View the All Script in ONE PAGE

        Hi Finian & Dave

        Thanks you for your advice.

        For save the record, it is better to write the script with Enter.begin() and Enter.end() and Change.being() and change.end with the field required or just use the code topparent.commit(). Which one is faster to save the record while many users are using the application software at the sametime?

        If I use Enter.Begin() function, means I need to create 5 script for each of the form because it is required to stated the field name and the form control field in order the add or update the record.

        Please advice.

        Comment


          #5
          Re: View the All Script in ONE PAGE

          Hi

          I have 5 button on the form -> delete, edit, save, new and exit.

          How do I write the script to know which button the user is click before I use the select...case?

          Please advice. Many thanks.

          Comment


            #6
            Re: View the All Script in ONE PAGE

            Unless you are doing something unusual, those functions (delete, edit, save, new and exit) require NO code at all. Just use Action Scripting and locate the appropriate action. There is no reason to use anything fancy such as enter_begin() and such. There is no need to individually identify the fields on the form (which you would have to do inside the enter_begin/end() function.

            In fact, since these button functions you have are standard menu options, you can pick Pre-Defined Button from the Define Button dialog and find the appropriate menu option.

            Again, unless you are doing something unusual.
            Steve Wood
            See my profile on IADN

            Comment


              #7
              Re: View the All Script in ONE PAGE

              Yes. The action script for the button is very useful. But when u copy the form to other table, I need to change one by one to take impact. That is take a lot of time.

              Additional of that, I need to put in the control when the user want to perform some action. For example, field is required before save, check the database relationship before delete the record etc. These are the impt control required for database design. And sometime need to update different table (perform some calculation) when the user click save the record.

              I have used the action script to do one form and copy the form to other table. I found that I need to go to every script to check to ensure there is no error and need to change the field name e.g. Focus an object with different field name. That takes a lot of time to do that.

              I need to find more effective way to do the script.

              Comment


                #8
                Re: View the All Script in ONE PAGE

                Well, I don't know the details of what you are doing, but -- its often true that -- none of the things you mentioned require any script, or form or table-specific code.

                Normally (again, don't know if you are doing something unusual), required fields are handled at table level in Field Rules, relational integrity when deleting a record is handled in the Set structure, and you can use Field Rules to post values to other tables based on action, and most of the time when you have to post some calculation to another table, its because your database is not properly normalized; that is the calculated field on the other form should be derived dynamically from a relationship to the updated form.

                Again, don't know your situation, but this might present some options. If you are coming from Access, it probably behaves differently. Alpha's Field Rules are simply awsome in what they can be used to accomplish.

                The other suggestion in this conversation was to use the Code Editor. That means you create all of your script outside of the button, under Alpha's Code tab. Then your button is only told to run that script. If you have to write scripts that makes it easier to manage.

                Personally, I would never tie two buttons to the same script, if those buttons performed materially different functions. That is, I might combine if two buttons did Print to Printer and Print to Email respectively. But not when they perform actions as diverse as the five buttons you have.
                Steve Wood
                See my profile on IADN

                Comment


                  #9
                  Re: View the All Script in ONE PAGE

                  Follow Steve's advice. Some things in programming is redundant and time consuming. They still have to be done.

                  Sometimes wish I could just wave a magic wand.

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

                  Comment


                    #10
                    Re: View the All Script in ONE PAGE

                    As a general rule, it shouldn't be necessary to code this stuff in detail. You can do as Steve suggested and, generally, you'll be OK.

                    For example, due to persistent "unable to define lookup" errors we were forced to forego the use of field-rule-defined lookups in certain layouts. To resolve this problem I coded all the lookups from field events and buttons on one form and consolidated them in a single script.

                    If you have a script_play("Scriptname") on a button then you can use a construct such as

                    Code:
                    formname = topparent.name()
                    buttonname = this.name()
                    
                    select
                    case formname = "patientinformation" and buttonname = "PatinfSaveButton"
                    'insert code here
                    case formname = "patientinformation" and buttonname = "PatinfNewRecordButton"
                    'insert code here
                    End select
                    to identify which object the code should address. Coding for field events requires declaring a shared variable in the event code (prior to running the script_play command. The following runs in the OnArrive event of a field called Com1_Name.

                    Code:
                    dim shared thisevent as c
                    thisevent=This.name()+"_OnArrive"
                    script_play("PatInfLookups")
                    thisevent=""
                    end
                    and the "PatinfLookups" code includes the following

                    Code:
                    dim shared thisevent as c
                    dim thiscom1 as c
                    select
                    case thisevent="Com1_Name_OnArrive"
                    'more code here
                    End select
                    I'm not advocating this a regular practice, but when you need it you need it.
                    Finian

                    Comment


                      #11
                      Re: View the All Script in ONE PAGE

                      Thanks, Finian. I always enjoy reading your code. Your style is "not too hot" and "not too cold", it's "just right". -- tom

                      Comment


                        #12
                        Re: View the All Script in ONE PAGE

                        Hi Finian Lennon

                        Thanks for your advice. I managed to write the script to control the button on the form.

                        What about the Forms Events? Such as "CanExit", "OnInit", "OnExit"...

                        Your guidance is very appreciated. Many thanks.

                        Jack Lim
                        Many Thanks.

                        Jack Lim

                        Comment


                          #13
                          Re: View the All Script in ONE PAGE

                          Hi Jack:

                          I identify the object and event in the code that runs the script_play. Like:

                          Code:
                          dim shared thisevent as c
                           thisevent = This.name()+"_OnArrive"
                            script_play("PatInfLookups")
                             thisevent = ""
                          end
                          Finian

                          Comment


                            #14
                            Re: View the All Script in ONE PAGE

                            Finnian, out of curiosity, how are you letting them do lookups - xdialog? ui_get_list_array()? - custom form?
                            Cole Custom Programming - Terrell, Texas
                            972 524 8714
                            [email protected]

                            ____________________
                            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                            Comment


                              #15
                              Re: View the All Script in ONE PAGE

                              Hi Martin:

                              I started replacing field rule lookups back in V4 so those are done with custom forms.

                              Anything more recent I've done with xdialogs.
                              Finian

                              Comment

                              Working...
                              X