Alpha Video Training
Results 1 to 1 of 1

Thread: Xbasic Syntax Checker

  1. #1
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Xbasic Syntax Checker

    Check this out. One of my clients has to enter complex xbasic math formula to derive values for records during a process. An example formula might be ROUND_UP(SQFT * 1.5 , 2). "round_up" is an xbasic function and "SQFT" is a local variable that they set somewhere else in the application. There are many dozens of these local variables, all stored in a table named local_vars.

    The formula are complex enough that they need to check the syntax for accurate xbasic function use, balanced parenthesis, and that any local vars used are indeed in the local_vars table.

    Somewhere else in the system they fire off a process that uses all of these calculations inside an SQL script such as INSERT INTO mytable (hours) VALUES (myformula). Where "myforumula" is the formula set in the grid (as defined above). Obviously if the formula is bad, it will blow the entire SQL query.

    So I wrote this Syntax Checker that validates the xbasic expression including validating that the local vars are legitimate.

    In the attached images, the first image shows the syntax as invalid because there is no xbasic function named "ROUNDUP()", it is named "ROUND_UP()"

    In another part of the application I have a button that checks ALL of the formulas and returns a list of the records with bad formula. Given that the client has hundreds of such formula, this is a big time saver.
    Attached Images Attached Images
    Last edited by Steve Wood; 07-29-2014 at 05:09 PM.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

Similar Threads

  1. syntax for if and/or in xbasic
    By jennygong in forum Application Server Version 11 - Web/Browser Applications
    Replies: 4
    Last Post: 11-05-2013, 04:53 PM
  2. where is the syntax checker?
    By Robert Davis in forum Alpha Five Version 5
    Replies: 1
    Last Post: 10-13-2004, 07:50 AM
  3. XBasic syntax
    By Peter Lear in forum Alpha Five Version 5
    Replies: 3
    Last Post: 10-05-2003, 11:44 PM
  4. Xbasic Syntax
    By Richard Slater in forum Alpha Five Version 5
    Replies: 3
    Last Post: 06-13-2003, 11:15 AM
  5. Spell checker syntax
    By whanigsberg in forum Alpha Five Version 5
    Replies: 3
    Last Post: 09-07-2002, 02:19 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
  •