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

a5_eval_expression not working ....

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

    a5_eval_expression not working ....

    I think i found a bug where conditional expressions are being generated by alpha, but not working ..... looks like its due to a5_eval_expression. I emailed this bug to Alpha .... will see what they say. Is anyone else having issue with a5_eval_expression? I also think i ran into problem with normal eval(), but just worked around because i didnt have the time to doc or debug.

    I attached a screenshot of debug and the steps that can be used to test are below. If i missed something (which is extremely possible), please let me know.

    Bug Description:
    A5_eval_expression not working .....

    1) create form with one button
    2) create script for push event
    3) use action scripting
    4) first action executes popup that give 2 choices ... "Charges" / "Payments"
    5) pop-up usually sets script variable, but for purposes of test, I explicitely set to "Payments"
    6) second action is to open "Charge" form only if script variable is set to "Charges"
    7) set condition for second action to expression of var->vpopupreturn = "Charges" (i used expression builder)

    8) I then run form and turn on debug for the button ....
    9) I create watch variable for vpopupreturn
    10) I see that vpopupreturn = "Payments"
    11) Steping through script, the script uses a5_eval_expression to eval vpopupreturn and even though it doesnt equal "Charges", it still goes to next statement. This conditional expression was generated by a5.

    Thanks again ...

    Glenn

    #2
    Re: a5_eval_expression not working ....

    Also wanted to post a small snippet of code that i used to check out a5_eval_expression and seems to prove(to my blind eyes anyway), that its not working correctly. If anyone can take a look just to at least validate that im not going crazy.
    Code:
    dim vpopup as c
    vpopup = "Payments"
    if a5_eval_expression("vpopup = \"Charges\"") then
     msgbox("","It thinks vpopup = charges",UI_INFORMATION_SYMBOL)
    else
     msgbox("","It doesnt think vpopup = charges",UI_INFORMATION_SYMBOL)
    end if
    this code snippets executes and comes up saying that it thinks vpopup = "Charges"

    Thanks in advance ....

    Glenn
    Last edited by AaronBBrown; 02-28-2007, 12:35 PM.

    Comment


      #3
      Re: a5_eval_expression not working ....

      I think it is doing exactly what it is supposed to do but I can understand your confusion.

      On the surface, one could assume that "eval_expression" would simply evaluate whether your expression was True or False - which is the way your example is using it. However, note that the result of the A5_eval_expression() function is not T/F but a character field. The function is not intended to return a T/F result.

      The value returned is the character representation of what is being evaluated. In this case, what is being evaluated is so simple that the result is essentially the same as the input.

      From the Interactive Editor:
      Code:
      vpopup = "Payments"
      ?a5_eval_expression("vpopup = \"Charges\"")
      = vpopup = "Charges"
      ?vpopup = "Charges"
      = .F.
      ?vpopup = "Payments"
      = .T.
      Note that the A5_eval... returns what was inside the expression but it did not actually change the value of vpopup. vpopup is still equal to "Payments".

      If you really want to test for T/F, don't get so complicated. Just use:
      IF vpopup = "Charges"

      Also note that a non-empty string always returns .T. Try running the following then remove the 1 and just run it with a blank value:
      Code:
      IF "1"
         ui_msg_box( "TRUE", "" )
      ELSE
         ui_msg_box( "FALSE", "" )
      END IF
      If you really need to use an eval because one side or the other comes from a more complex "source", use something like:
      IF vpopup = a5_eval_expression(.....)

      You can even use:
      If eval( .... ) = eval( .... )

      However, you will probably have to be careful about how you create the expression. It is very easy to think you have the right expression but miss some small detail (often quotes) that totally changes the result. During development, check the individual results returned by each Eval before using it.

      Using your example, I first tried:
      IF a5_eval_expression("vpopup") = a5_eval_expression("\"Payments\"")
      but that always returned .F.

      When I tried:
      IF a5_eval_expression(vpopup) = a5_eval_expression("Payments")
      it finally worked correctly - but this would be much easier to write, read, and understand:
      IF vpopup = "Payments"

      Note: In case this was started or based on a Genie result, remember that just because the Genie does it one way doesn't mean that's always the best way. The Genie has to be built with "safety features" because there is no way to be sure what someone will try to do with it. When writing your own code, simplify it whenever possible. (But keep in mind that users do make mistakes and you should try to out-quess them and build code that allows for likely mistakes.)

      Disclaimer: I've used Eval() a lot but not A5_eval_expression(). I believe they are similiar except that A5_eval_expression() "evaluates an expression in the context of the current form or browse window" as stated in the Help file. The plain Eval() function doesn't seem to have anything to do with the current window.
      Last edited by AaronBBrown; 02-28-2007, 12:35 PM.

      Comment


        #4
        Re: a5_eval_expression not working ....

        Cal,
        Thanks for the feedback, but im not really confused. The issue was when i use action scripting and I put a condition on the action, it doesnt work. When I debug the code, it show that the alpha5 generated code does an "if" against an alpha generated a5_eval_expression. Unfortunately i dont have control over the way alpha generates this conditional code. The way it is being generated now ..... just doesnt work. With that said, I went straight to xbasic and simplified the code and worked around the issue. My problem is that I use a blended aproach to programming in alpha and have alot of action scipts versus just xbasic. I have never had this issue with conditional actions before and i am pretty sure it was introduced in v8 .... just want to make sure its pointed out and gets fixed. I luv to use action scripting for some things, and yes, i luv writing xbasic for others .... they are equally as important to me.

        The little bit of code i posted as a supplement was a run-down copy of what alpha generates for code based on the conditional expression(take a look at screenshot). Before having to dig into this and debug a bit, i didnt even know a5_eval_expression existed ... :)

        I would luv this not to be a bug, but all points to it being one .....

        Thanks again ....

        Glenn

        Comment


          #5
          Re: a5_eval_expression not working ....

          Yup. If A5 generated that, I'd say it was a bug.

          Comment


            #6
            Re: a5_eval_expression not working ....

            After speaking with Cian from Alpha in another post, he indicated this might be fixed. I downloaded latest beta patch .... still not working. See atachement of debug ...

            Shows variable being set ....
            shows a5_eval evaluating expression incorrectly

            Unless i am missing something, this is a bug. I sent to alpha, but outside of the side response from Cian, I have had no direct response. Since this is Alpha generated, I would assume all conditional actions would be under question and would effect anyone converting an ap to v8. If I dont hear anything on this post, I will re-submit as bug.

            Thanks in advance ....

            Glenn

            Comment


              #7
              Re: a5_eval_expression not working ....

              Originally posted by peterg000 View Post
              After speaking with Cian from Alpha in another post, he indicated this might be fixed. I downloaded latest beta patch .... still not working. See atachement of debug ...

              Shows variable being set ....
              shows a5_eval evaluating expression incorrectly

              Unless i am missing something, this is a bug. I sent to alpha, but outside of the side response from Cian, I have had no direct response. Since this is Alpha generated, I would assume all conditional actions would be under question and would effect anyone converting an ap to v8. If I dont hear anything on this post, I will re-submit as bug.

              Thanks in advance ....

              Glenn
              Actually, I did respond to you - you might want to check your Junk Mail folder. I sent you a test database in which I tried to recreate your scenario, that proved the a5_eval_expression() works correctly.

              If you have a test database that show a5_eval_expression() not working as you would expect, then attach it to a message so that we can run it on our machines. You are much more likely to get a response that way than by posting images of a debug window.

              Comment


                #8
                Re: a5_eval_expression not working ....

                Sorry Selwyn ... checked all folders, not there. Maybe Yahoo didnt like attachment for some reason. If you would like to post up here, that would be great or I can just put something together and send you. Did you look at the latest screenshot that shows the var being set and then the next a5_eval_expressions just kinda ignoring?

                Let me know ....

                Thanks again for taking the time to look into this ...

                Glenn

                Comment


                  #9
                  Re: a5_eval_expression not working ....

                  Glenn Selwyn already asked you in his message to send the files and also told you that your screen shots were not helpful. He's busy but willing to help, so I doubt he's going to want to ask twice.

                  Comment


                    #10
                    Re: a5_eval_expression not working ....

                    Thanks doug ..... understand busy. We havent gotten past the step of selwyns test database ..... which i was pointing out didnt get to me and if he didnt think it was worth working with that, i would try alternative route. And since he went to trouble to create I was hoping he would resend or post here so i could work with that instead of trying to slice it out of my large database.

                    Glenn

                    Comment


                      #11
                      Re: a5_eval_expression not working ....

                      Selwyn,
                      Here is backup of debug database ..... form "testa5_eval" .... wipped up fast, but hopefully shows exactly what the screenshot showed. It already has debug on.

                      Thanks!!

                      Glenn

                      Comment


                        #12
                        Re: a5_eval_expression not working ....

                        Glenn,
                        In your example, you set the variable in the action scripting to "diag1". This is seen by Alpha as "diag1", not diag1. The conditions of = diag1 will not be met because you have created the Character variable to be "diag1". You do not need the quotes to delineate it as a character variable in this action script line.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: a5_eval_expression not working ....

                          Mike,
                          Spot on ....... thanks!!! ...... Always getting confused as to when to use quotes and when not to ...

                          Thanks again!!

                          Glenn

                          Comment


                            #14
                            Re: a5_eval_expression not working ....

                            Glenn,
                            I have been typing ui_msg_box() forever. I see Cal used it too Thank you for pointing me to msgbox(). I will also offer up this which was posted about a year ago (mograce maybe?) and is also in the code archives somewhere. It is a chart for the codes for the dialog boxes, so you do not have:

                            ui_msg_box("notice","text here",UI_INFORMATION_SYMBOL), but instead
                            ui_msg_box("notice","text here",64).

                            I have mine in my Code Library for reference. It looks all out of line and format on the screen but if you Cut and Paste it from the screen into the Interactive Window, it formats OK.


                            Code:
                            1ST BUTTON DEFAULT	  NO SYMBOL	STOP QUESTION ATTENTION	INFORMATION	 RESPONSE
                            UI_OK	                    0	 16	    32	     48	       64		  1 = OK
                            UI_OK_CANCEL	            1	 17	    33	     49	       65		  2 = CANCEL
                            UI_ABORT_RETRY_IGNORE	    2	 18	    34	     50	       66		  3 = ABORT
                            UI_YES_NO_CANCEL	        3	 19	    35	     51	       67		  4 = RETRY
                            UI_YES_NO 	                4	 20	    36	     52	       68		  5 = IGNORE
                            UI_RETRY_CANCEL	            5	 21	    37	     53	       69		  6 = YES
                            							                                          7 = NO
                            2ND BUTTON DEFAULT		
                            UI_OK_CANCEL	          257	273	   289	    305	       321		
                            UI_ABORT_RETRY_IGNORE	  258	274	   290	    306        322		
                            UI_YES_NO_CANCEL	      259	275	   291	    307	       323		
                            UI_YES_NO 	              260	276	   292	    308	       324		
                            UI_RETRY_CANCEL	          261	277	   293   	309	       325		
                            							
                            3RD BUTTON DEFAULT	
                            UI_ABORT_RETRY_IGNORE	 514	530	   546	    562	       578	
                            UI_YES_NO_CANCEL	     515	531	   547	    563	       579
                            Mike W
                            __________________________
                            "I rebel in at least small things to express to the world that I have not completely surrendered"

                            Comment

                            Working...
                            X