Alpha Video Training
Results 1 to 12 of 12

Thread: A/S set Variable to Constant or Expression

  1. #1
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default A/S set Variable to Constant or Expression

    The Action Script "Set Variable to Constant or Expression", instructions indicate that you must NOT surround constants with quotes.

    Attached sample 1 works fine. Checking for a blank date {}.

    Attached sample 2 does not work because I cannot figure out how to indicate a character blank without using quotes e.g. " ". Also if I remove the quotes fro "A" I get error message "Invalid or incomplete expression ?

    As always, any suggestions appreciated.

    Thanks, John

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default

    John, which image is sample 1 and which is sample 2? I confuse easily. :)

    Assuming Script Variable 1 is sample 2, I don't see anything wrong. Have you misspelled something? The use of quotes to denote an empty character string is permitted. I just used the following expression successfully in an action scripting statement in the OnPush event for a button on a form:

    Code:
    =if(var->A = "","Empty","")
    -- t
    Last edited by Tom Cone Jr; 12-13-2005 at 03:01 AM.

  3. #3
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Tom

    Apparently the AS script editor does NOT want quotes. If I set the variable using the interactive editor, then run the script all is well. It appears the AS script is ignoring the action due to the quotes. Spelling appears OK.

    See attached.

    Thanks for your response. Off to work, will check back this evening.

    John

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default

    John, I entered the expression using the expression builder. There's a button (icon) on the AS dialog to open the expression builder, it has a small X-Y image and it located at the right edge of the text box you're typing in when you enter the expression...

    -- tom

  5. #5
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Tom

    Have used the expression builder and it appears ok. However when I run the script it just does'nt work.

    I will reduce the app & post a sample as as soon as I can. Problem is its large integrated app & not easy to reduce.

    Thanks, John

  6. #6
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Tom

    I have reduced the app to bare minimum & zipped up with instructions on how to duplicate the problem.

    If you have the time I would appreciate if you could have a boo at it.

    Thanks, John

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default

    Sorry, can't get past the login screen. Password won't work. -- t

  8. #8
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Tom

    Password = Carriage return

    John

  9. #9
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default

    Quote Originally Posted by John Gamble
    Tom

    Password = Carriage return

    John

    Well, that sure makes me feel foolish!

    John, I think the prohibition against using quote marks is only applicable when you are entering a constant. I think it is permitted to use quote marks when entering an expression (which is denoted by the leading equals sign, in this context).

    For example.

    I duplicated your MainMenu form and changed your red square button's script so that it does three things:

    a) assign a null string to the variable, using the default value option in the xdialog
    b) read the variable, and if it's empty, assign "A" to it or if it's not empty assign "P" to it.
    c) display the variable in a message box.

    Everything works predictably. The action script is NOT having trouble detecting whether the variable is empty.

    Unzip the attachment to an empty folder. Open my form (TomsMenu) and explore the script. When you test this leave all the input fields empty, and just click the OK button.

    In your Menu form the red square button script assigns a default value of "A" to the variable. Mine assigns an empty string. Then the null is detected, and a second assignment places the "A" there.

    I don't have time to untangle this but it seems to me that the problem you're having may lie within the expression used to filter the report. The absence of parentheses to separate the various boolean components of the filter expression meaningfully may be causing order of precedence issues which you may be overlooking.

    -- tom
    Last edited by Tom Cone Jr; 12-14-2005 at 02:49 PM.

  10. #10
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Tom

    I think you accidently zipped & sent my original data back.

    Thanks, John

  11. #11
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,300

    Default

    Nope. Check the Forms tab of the control panel for a new form named "TomsMenu" -- tom

  12. #12
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Tom

    Allright, so I'm blind as well as suffereing from sometimers.

    Thanks again, John

Similar Threads

  1. variable constant
    By Dale Stansbery in forum Alpha Five Version 5
    Replies: 6
    Last Post: 09-26-2003, 11:42 AM
  2. Question about Set Variable to Expression Result
    By Robert Cheley in forum Alpha Five Version 5
    Replies: 1
    Last Post: 07-08-2003, 06:52 PM
  3. Using Script Variable in Expression
    By Dean Hall in forum Alpha Four Versions 7 and 8
    Replies: 4
    Last Post: 11-01-2002, 03:42 AM
  4. Constant Global variable
    By Dennis Silver in forum Announcements
    Replies: 2
    Last Post: 03-29-2001, 09:37 PM
  5. Constant Variable
    By Stephen Horne in forum Alpha Five Version 4
    Replies: 4
    Last Post: 10-19-2000, 12:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •