Alpha DevCon 2018
Results 1 to 10 of 10

Thread: Expression builder

  1. #1
    Member
    Real Name
    Kate Hurst
    Join Date
    Jul 2014
    Posts
    5

    Default Expression builder

    Hello,

    I am working on a customer database and I have a field consisting of a 5 digit reference. I have created a new field which I want to update with just the first 2 characters of the 5 digit reference. Can anyone help me in writing the correct expression to do this?

    I am very new to Alpha 5.

    Kate

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

    Default Re: Expression builder

    Hi Kate - Welcome to the board!
    To populate the new field with existing data from the other field try an Update operation. Assign a calculated value to the new field such as
    left(fieldA,2)

    After the update, you can set a field rule to do the same calculation automatically on data entry.
    Robin

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

  3. #3
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,430

    Default Re: Expression builder

    Quote Originally Posted by MoGrace View Post
    Hi Kate - Welcome to the board!
    To populate the new field with existing data from the other field try an Update operation. Assign a calculated value to the new field such as
    left(fieldA,2)

    After the update, you can set a field rule to do the same calculation automatically on data entry.
    I'll add a note before Dr. FussBudget does...

    A safer way is: (just in case the field is not left justified... unless you want the spaces that might be there....)

    left(alltrim(fieldA),2)

    or

    left(ltrim(fieldA),2)
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

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

    Default Re: Expression builder

    Now who could Mr. Fussbudget possibly be??? Surely you don't mean Ira the function purist?
    Robin

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

  5. #5
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,430

    Default Re: Expression builder

    Quote Originally Posted by MoGrace View Post
    Now who could Mr. Fussbudget possibly be??? Surely you don't mean Ira the function purist?
    No not at all. I'm thinking of the Murphy's cousin that always attacks my code with the unexpected data variations.

    Vaguely related to Dr. Nitpicky
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  6. #6
    Member
    Real Name
    Shivanand Baswannappa
    Join Date
    Sep 2014
    Posts
    2

    Default Re: Expression builder

    I am new here and have just started using alpha for development.
    I am trying to get a value of YES or NO assigned to a field1 on the grid, based on whether field2 value is between field3 and field4. field2, field3 and field4 are numeric.
    I used the property "calculated field expression" for field1 as follow:
    if( (field2 < field3 or field2 > field4), 'NO','YES')
    the client side value for field1 evaluates correcty, but when it is posted to the database, it always whatever evaluates to true condition. I mean the value stored is always NO.
    Am I doing something wrong?
    Can somebody correct me?

    Appreciate any input
    Shiva

  7. #7
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,430

    Default Re: Expression builder

    Please attach an image of the expression builder that you are using.

    Also how is the field1 defined?
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  8. #8
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,005

    Default Re: Expression builder

    try

    if( (field2 < field3 .or. field2 > field4), 'NO','YES')

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

    Default Re: Expression builder

    If(field2 < field3,"no",if(field2 > field4,"no","yes"))
    Robin

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

  10. #10
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Expression builder

    fld1=if(fld2 > fld3 .and. fld2 < fld4,"Yes","No")
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

Similar Threads

  1. expression builder
    By John Burke in forum Alpha Five Version 6
    Replies: 1
    Last Post: 08-06-2004, 06:57 AM
  2. IF THEN ELSE in expression builder
    By Luc Verlee in forum Alpha Five Version 5
    Replies: 5
    Last Post: 02-05-2004, 03:39 AM
  3. Expression Builder
    By Bob Whitaker in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-16-2004, 02:15 AM
  4. Expression Builder
    By Scott Rusoff in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-17-2003, 07:41 AM
  5. Using the expression builder
    By Jim Dompier in forum Alpha Five Version 4
    Replies: 6
    Last Post: 10-23-2001, 06:55 AM

Posting Permissions

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