Alpha Video Training
Results 1 to 8 of 8

Thread: Xbasic run in editor -v- Xbasic run from button

  1. #1
    Colin Goss
    Guest

    Default Xbasic run in editor -v- Xbasic run from button

    I have a script that counts members of a number of clubs, also deaths, numbers of joining, resignations etc.

    I couldn't get this to run in a report.

    So I wrote an Xbasic script - runs great in the editor and the totals are correct.

    But when I place a script_run instruction on a button to run this script, none of the totals appear - they are all zero. Why should this happen?

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

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Colin,

    To troubleshoot this I'd add a line or two at the end of the script to display the results in a ui_msg_box().

    Alternatively, I'd modify the script to write the results to the trace window.

    Purpose of this is to verify that your script runs ok from the button. If so, it is a good indicator that you have a display problem, perhaps a need to update, refresh, or resynch a field on your form.

    If the script doesn't run correctly from the button, the first thing I'd check is verifying that the script succeeds in opening whatever table is needed to do the calculation. If the table is opened already (i.e. it's a table upon which the form is fully or partially based), then there may be a naming conflict when your script tries to open the next instance of the same table. Check the docs on the table.open() command if this is the case.

    -- tom

  3. #3
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Assuming that you used Script_Play("Scriptname") and not Script_Run("Scriptname") -which is not a valid Xbasic method -

    If the script is run from a button which also issues the print report command, you will need to dimension as global the variables for the totals you calculate in the script AND will neeed to add those same variables as global to your report.

    Finian Lennon

  4. #4
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Script_run was an A5v1 command. It is probably still supported by version 4 but not recommended. I believe it reacts slightly differently as well but it's been a long time (years) since I compared them.
    Syntax: script_run(Script Name, Data Dictionary Filename)

    Colin,

    When you run the script in the editor, where do the results appear? In a message box?

    You might consider putting the script in your message here or attach it in a text file if it is large. I'm sure at least one person will review it.

  5. #5
    Colin Goss
    Guest

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Thanks for reponses

    I should have added that I put a debug(1) at the end of the script and checked the results in the watch window. This is how I can be certain that the figures are there when run from the code editor, and zeros when run from the button.

    The button was set up using the button genie and carries the instruction "run script .

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

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Colin,

    In many areas of Alpha Five context is everything.

    The fact that the script runs correctly in one setting (in script editor)... does not mean, necessarily, that it will run correctly from a button on your form.

    I suggest you try the ideas suggested in my first post.

    -- tom

  7. #7
    "Certified" Alphaholic Melvin Davidson's Avatar
    Real Name
    Melvin Davidson
    Join Date
    Apr 2000
    Location
    Parker, CO
    Posts
    1,197

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Here's a thought.

    Since you say you verified the results are correct in the script, but the totals are zero, have you checked if the variables are GLOBAL or LOCAL?

  8. #8
    Colin Goss
    Guest

    Default RE: Xbasic run in editor -v- Xbasic run from butto

    Thanks to everyone for their help.

    I decided that it was probably easier to rewrite it completely in the form rather than in the global scripts and it now works fine.

    I still do not understand why the script produced different results when run in different areas of the programme. However I have the results I need, so I shall stop worrying about it.

Similar Threads

  1. Use of external editor with A5 Xbasic?
    By brett s in forum Alpha Five Version 6
    Replies: 24
    Last Post: 10-28-2005, 09:56 AM
  2. Xbasic Code Editor and table.get()
    By Jim Chapman in forum Archived Wishlist
    Replies: 6
    Last Post: 12-02-2004, 06:46 AM
  3. Xbasic editor enhancements.
    By Marcel Kollenaar in forum Alpha Five Version 6
    Replies: 11
    Last Post: 08-13-2004, 07:41 PM
  4. XBasic editor query - is there a better way?
    By brett s in forum Alpha Five Version 5
    Replies: 2
    Last Post: 07-08-2004, 06:46 PM
  5. XBasic Editor
    By Dennis Silver in forum Alpha Five Version 4
    Replies: 2
    Last Post: 04-10-2000, 05:22 AM

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
  •