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

Setting variables onfetch

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

    Setting variables onfetch

    On my main form which is based on a set, I am trying to set variables ( name, address, etc..) from the parent table.
    But when I navigate through the records the variables don't change.
    I have them set on the onfetch event . vname =cif->name etc..
    What am I doing wrong?

    Thanks
    BobG

    #2
    Re: Setting variables onfetch

    No sample attached so we have to play 20 questions.

    What is the scope of the variables? Where did you define them?
    There can be only one.

    Comment


      #3
      Re: Setting variables onfetch

      Set variables on main menu as global.

      Comment


        #4
        Re: Setting variables onfetch

        Bob,

        Call as local variable and write <object, your_variable_name>.refresh()

        Comment


          #5
          Re: Setting variables onfetch

          Your code

          vname =cif->name

          doesn't refer to a global variable. It refers to a local variable, in the absence of other instructions.


          Dim global vname as C
          vname =cif->name

          This tells Alpha that you want to do something with the global variable vname and are not working with a local variable.

          Note: Dim global vname as C doesn't change the value of a previously established variable. It only tells Alpha that for the purposes of the current code you mean to do something with the global variable.
          There can be only one.

          Comment


            #6
            Re: Setting variables onfetch

            So is everyone telling me that the GUI interface of alpha is not reliable, and that I should use code.
            Example, My Main Menu, I go to Form > Variables> Global Tab and than define variable by genie , ie vname="".
            Next I select the form from the menu and set that variable onfetch with the value from the table vname= cif->name.
            This work for the first record, but when I goto the next record it doesn't change.
            Attached Files

            Comment


              #7
              Re: Setting variables onfetch

              Nobody said the GUI is unreliable. For someone who's done it several times in the action scripting mode and seen the code behind it the code is familiar.

              If you use action scripting you can see that you have to choose the scope of the variable there as well.

              var.png

              Below is the xbasic behind the action script in the screenshot.

              'Get 'Value' property of 'Name' in Form 'Untitled' .
              DIM GLOBAL cvariable AS c
              cvariable = parentform:Name.value

              If the variable is a session/shared variable, first tab of the variable definition genie, and you create an action script to set it to a field value the xbasic behind it is

              'Get 'Value' property of 'Name' in Form 'aaa' .
              DIM SHARED cvariable AS c
              cvariable = parentform:Name.value

              In neither case can you omit the dim statement without Alpha thinking you are simply creating a new local variable.
              Last edited by Stan Mathews; 11-15-2013, 06:35 PM.
              There can be only one.

              Comment


                #8
                Re: Setting variables onfetch

                Hi Stan,
                I not talking about the action script, but the tool bar in design mode for forms.
                Forms >variables> global tab. define variables.
                Why doesn't that work?

                Bob

                Comment


                  #9
                  Re: Setting variables onfetch

                  I don't think it matters where you define the variable. The issue is that your code doesn't tell Alpha to specifically refer to the global variable. Without a dim statement in the code Alpha assumes you are creating a new local variable and assigning a value to it. The global variable placed on the form is a different thing.
                  There can be only one.

                  Comment


                    #10
                    Re: Setting variables onfetch

                    Stan I get what you are saying.
                    If you can be patient with me, I would appreciate it.
                    OK I have a quote number which has to be passed to Reports. Say vQuote.
                    I declared it on my main menu form Using from the tool bar forms> varaibles > global: vQuote="".
                    This is where I get confused. When I go to the quote form and get the quote number into the variable vQuote, where and how would I do that.

                    Thanks Bob

                    Comment


                      #11
                      Re: Setting variables onfetch

                      Bob its easier to help you if you supply sample data and forms.

                      If the object in your form that contains the quote number from your table is named "QuoteObject", and
                      If the quote number is character data; and
                      if the quote number is in the parent table of the set supporting your form...

                      then you can update the variable value in the form's onFetch event with a script like this:

                      ' onFetch event in form
                      dim global vQuote as C
                      vQuote = this:QuoteObject.value

                      Use the drag/drop list to put the variable on your form and watch it change as you fetch through your records.


                      if your script says this:

                      vQuote = this:QuoteObject.value

                      the quote number gets stored in a local variable named vQuote. Why? Because in xbasic, all variables are assumed to be local to the script unless you specify a different scope with a dim statement.

                      Yes, its easily possible to have multiple variables all name vQuote...

                      Comment


                        #12
                        Re: Setting variables onfetch

                        Bob said:

                        So is everyone telling me that the GUI interface of alpha is not reliable, and that I should use code.
                        Example, My Main Menu, I go to Form > Variables> Global Tab and than define variable by genie , ie vname="".
                        Next I select the form from the menu and set that variable onfetch with the value from the table vname= cif->name.
                        This work for the first record, but when I goto the next record it doesn't change.
                        You were probably updating a local variable with the same name, instead of the global variable, for the reasons outlined in my previous post. The GUI in Alpha Five is reliable.

                        Comment


                          #13
                          Re: Setting variables onfetch

                          Hi Tom,
                          So on the onfetch event in form, I create an inline xbasic action script to put
                          dim global vQuote as C
                          vQuote = this:QuoteObject.value

                          Comment


                            #14
                            Re: Setting variables onfetch

                            Bob, think of it like this

                            1. You need to give the variable a value every time a record is fetched.
                            2. You need to design a form that displays this variable as an object

                            1. Is done with on fetch, 2. is not.
                            1. can be done without 2. if you want the variable present only for coding or calc purposes
                            2. Allows you when designing a layout to place the object. It does not re-assign any value but by default.

                            BOTH are required for what you are describing. You then have two placeholders for the table value. One a variable and 2 a form object.
                            You can choose in your process to use either. Although addressed differently they will return the same value.

                            SCOPE (shared for example) together with the identifying NAME links the two so that the correct value from table is assigned to the same variable that is displayed

                            Comment


                              #15
                              Re: Setting variables onfetch

                              Bob,

                              Yes, that should work just fine.

                              If your form is based on a set of tables you may find that the second line should use the actual form name, instead of the relative object name "this".

                              Can't test this here cause you've supplied nothing for us to work with.

                              Let us know how it goes.

                              Comment

                              Working...
                              X