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

"Variable not found" Error. Need Help!

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

    "Variable not found" Error. Need Help!

    I have a numeric (decimal) session variable, text box on a Web Dialog. I'm using it in a "Calculate" AdvancedButton that adds up the values of some of the controls. Why am I getting the following error?

    "Error in event handler code for OnClick event for 'Calculate': Variable "PSALevel" not found."

    I used the same technique on a different Dialog, and it worked there. I even deleted the control and put it back with no improvement.

    Help! Please!

    #2
    Re: "Variable not found" Error. Need Help!

    In most of your posts you provide too little information to go on.

    There is no such thing as a "numeric" session variable. All session variables are character. If your session variable is named session.PSALevel, then the reason your dialog can't find it is because it is named session.PSALevel, not PSALevel.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: "Variable not found" Error. Need Help!

      Actually, Steve, you can have a numeric session variable. I'm using numeric session variables in an application I'm working on right now.

      I think the confustion comes from assigning session variables from the fields on a grid or a dialog (which are character even though they are formatted to look numeric). In that case, they are character.

      However, if you assign a numeric value to a session variable with Xbasic, or assign it from a numeric table value, then it is numeric.

      Pat
      Pat Bremkamp
      MindKicks Consulting

      Comment


        #4
        Re: "Variable not found" Error. Need Help!

        Thanx for your help Folks:

        When I changed the variable names I got a different error:

        "Argument is incorrect data type"

        Here is the code:
        (Suicied and interest are Radio Buttons with values: 0, 1, 2, 3)
        DScore is a Label

        dim S as n
        dim I as n
        S = session.Suicide
        I = session.Interest

        DScore = S + I

        Comment


          #5
          Re: "Variable not found" Error. Need Help!

          I need to be more clear.

          Values in the fields on a web component like a dialog are, like Steve said, character value. If you created the session variables by changing the scope of the radio button field variables to session, then you have character values. So, the formula should be
          S = val(session.Suicide)
          I = val(session.Interest)
          DScore = str(S + I,2,0)

          However, if you leave the scope as local, then you can use
          session.Suicide=val(currentform.controls.suicide.value)
          session.Interest=val(currentform.controls.interest.value)
          DScore = str(session.Suicide+session.Interest,2,0)

          Pat
          Pat Bremkamp
          MindKicks Consulting

          Comment


            #6
            Re: "Variable not found" Error. Need Help!

            I copied your code into my event script and got a different error:

            "Error in event handler code for OnClick event for 'Calculate': Property not found
            session.Suicide subelement not found. "

            Comment


              #7
              Re: "Variable not found" Error. Need Help!

              Pat - OK, seems true. But you know I had to test it!:) The code below produces this output. It seems agnostic about quoting the value:

              as n wo quotes: 100.1 (N)
              as n w/quotes: 100.1 (N)
              as c wo/quotes: 100.1 (C)
              as c w/quotes: 100.10 (C)


              Code:
              delete session.num
              dim session.num as n
              session.num = 100.10
              ?"as n wo/quotes: " + session.num + " (" + typeof(session.num) + ")"
              
              ? "<br>"
              
              delete session.num
              dim session.num as n
              session.num = "100.10"
              ?"as n w/quotes: " + session.num + " (" + typeof(session.num) + ")"
              
              ? "<br>"
              
              delete session.num
              dim session.num as c
              session.num = 100.10
              ?"as c wo/quotes: " + session.num + " (" + typeof(session.num) + ")"
              
              ? "<br>"
              
              delete session.num
              dim session.num as c
              session.num = "100.10"
              ?"as c w/quotes: " + session.num + " (" + typeof(session.num) + ")"
              Steve Wood
              See my profile on IADN

              Comment


                #8
                Re: &quot;Variable not found&quot; Error. Need Help!

                EZ,

                It's simply means that session.Suicide does not exist at the moment the button is clicked.

                You have to ensure that variable has a value when it is needed. When writing code, for safety sake, you also must assume that it DOES NOT exist when needed. Example:

                if eval_valid("session.suicide") .and. eval_valid("session.interest")
                S = val(session.Suicide)
                I = val(session.Interest)
                DScore = str(S + I,2,0)
                else
                ?"Sorry, we are missing values"
                end if


                This still does not guarantee those variables have a value, the eval_valid() means they "exist" but they still could be null values.
                Steve Wood
                See my profile on IADN

                Comment


                  #9
                  Re: &quot;Variable not found&quot; Error. Need Help!

                  Steve:

                  How could these variables NOT exist? They are controls in the dialog component, and I'm filling them in before clicking the "Calculate" button.

                  Another anomaly:
                  A simple calculation, in another dialog, works fine, in a "Live Preview" or a "Browser" test, of the dialog component alone, but it stops working, when I Publish the page it is on, to the Webroot.

                  This is my first Alpha project, and I'm very confused! I appreciate your help.

                  Thanx,
                  EZ Rider

                  Comment


                    #10
                    Re: &quot;Variable not found&quot; Error. Need Help!

                    You may need to make sure you are publishing all of the changed files. I've sometimes had some trouble thinking I've made a change and the published location not reflecting that change because of this. In the publish dialogue you can specify to publish all files, not just the current one.

                    Comment


                      #11
                      Re: &quot;Variable not found&quot; Error. Need Help!

                      Gobbligook:

                      I have been publishing all files to the Webroot each time, but it makes no difference. I just tried it again now.
                      Thanx for the suggestion, though.

                      EZ Rider

                      Comment


                        #12
                        Re: &quot;Variable not found&quot; Error. Need Help!

                        How could these variables NOT exist? They are controls in the dialog component, and I'm filling them in before clicking the "Calculate" button.
                        That's actually not true. The form is not submitted when you click your AdvancedButton, so the session variables defined by your controls are never created or populated.

                        If you put your same forumla in the AfterValidate Event, those variables would exist and be populated.

                        I can't figure out why you want them to be session variables anyway. If the calculation is taking place in the same dialog, just refer to the field controls using the standard reference - currentform.controls.myfield.value.

                        I have NEVER defined a dialog control as scope=session in all the apps I have built.
                        Steve Wood
                        See my profile on IADN

                        Comment


                          #13
                          Re: &quot;Variable not found&quot; Error. Need Help!

                          Ooooh! So I have to submit the screen before the variables exist. I'll try that.

                          I made all the controls session variables because I wanted to refer to some of them, in the calculations made in other dialogs.

                          If I assign a value to a session variable, in one dialog, how can I put that value on the screen or use it in a calculation, in another dialog of the same session?

                          Thanx for your help,
                          EZ Rider

                          Comment


                            #14
                            Re: &quot;Variable not found&quot; Error. Need Help!

                            I can underestand your frustration, so let's try one more time

                            You are using dialogs, right?

                            So, in the dialog your calculation is in, set the scope of all the controls to "local".

                            When you fill in the value in the control, the value exists, and you can refer to it with currentform.contols.whatever.value which will give you a character value.

                            Now, if you have two of those, Suicide and Interest, and want to do math with them, you have two choices. If all you want to do is display the calculation, then you can define the DScore field as a textbox and put in a calculated Field Expression (that's in the Control Settings Prooperty sheet) of val(Suicide)+val(Interest). I've found that the dialog is smart enough to convert this formula back to string, but you can also do the conversion yourself to be safe.

                            Now, if you want to let the user override the value in the DScore field, instead you can fill the value in the control using your advanced button with the script
                            S = val(currentform.contols.Suicide.value)
                            I = val(currentform.controls.Interest.value)
                            currentform.controls.DScore.value = str(S + I,2,0)

                            Now if you want to use those values in another dialog in the same session, add the follwing script below the one just above

                            session.Suicide=currentform.controls.Suicide.value
                            session.Interest=currentform.controls.Interest.value
                            session.DScore=currentform.controls.DScore.value

                            That creates the session variables as character values

                            Now, in the dialog you want to use them in, put this in the initialize event

                            if eval_valid("session.Suicide")=.t.
                            currentform.controls.whateverfieldname.value = session.Suicide
                            else
                            what to do if it doesn't exist
                            end if

                            The whatever field name value is now properly a character value

                            same for the other two.

                            Pat
                            Pat Bremkamp
                            MindKicks Consulting

                            Comment

                            Working...
                            X