Alpha Video Training
Results 1 to 5 of 5

Thread: Code rationlizing

  1. #1
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    786

    Default Code rationlizing

    Is it possible to populate the array in this code snippet without running the filter twice ?

    Code:
    LR_filter = "Reg="-quote(alltrim(var->vSearchValue))
    LR_Order  = "reg"
    LR_rec_count = tablecount("logging",LR_filter)
    if LR_rec_count > 0 then
          dim LR_reg[LR_rec_count] as p
          LR_reg.initialize_from_table("Logging",LR_filter,LR_Order)
    end if
    thanks
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  2. #2
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,687

    Default Re: Code rationlizing

    Hmmm - what is the purpose of the hyphen before 'quote' shouldn't it be a ' + '

    LR_filter = "Reg="-quote(alltrim(var->vSearchValue))
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  3. #3
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    786
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,687

    Default Re: Code rationlizing

    The example from the help:
    Code:
    dim firstname as c = "Beverly        "
    dim lastname as c =  "Brine          "
    ? firstname - lastname
    = "BeverlyBrine          "
    ? firstname - "" + " " + lastname - ""
    = "Beverly Brine"
    Your example:
    ?"firstnamefield = "-quote(alltrim(var->firstname))
    Code:
    Beverly         ="Beverly"
    In the 2nd case above the only space removed by the hyphen was the one following the equal sign, it does not trim the content of the FIELD firstname
    Code:
    ?"firstnamefield" - " = " - quote(var->firstname)
    Beverly = "Beverly"
    Last edited by MoGrace; 08-25-2019 at 12:34 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    Member
    Real Name
    Jon P Moody
    Join Date
    Nov 2016
    Posts
    179

    Default Re: Code rationlizing

    Graham,

    This worked for me...

    Code:
    LR_filter = "Reg="-quote(alltrim(var->vSearchValue))
    LR_Order  = "reg"
    dim LR_reg[1] as p
    LR_reg.set_dynamic(.t.)
    LR_reg.initialize_from_table("Logging",LR_filter,LR_Order)
    set_dynamic(.t.) allows the array to grow/shrink as required.

Similar Threads

  1. Replies: 5
    Last Post: 05-01-2019, 10:53 PM
  2. xbasic code not returning data - but interactive code does????
    By RobGordon in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 11-25-2014, 08:34 AM
  3. How to convert .java class code to AlphaFive Xbasic code?
    By Suvarchala in forum Application Server Version 11 - Web/Browser Applications
    Replies: 4
    Last Post: 01-04-2012, 01:07 AM
  4. Why inline-javascript code fires before ajax callback UDF xbasic code?
    By eritovs in forum Application Server Version 10 - Web/Browser Applications
    Replies: 6
    Last Post: 10-29-2010, 08:46 AM
  5. Code Editor saved code to wrong script
    By Mike Wilson in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 09-22-2008, 03: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
  •