Alpha Video Training
Results 1 to 3 of 3

Thread: User input in a calculated field

  1. #1
    Member
    Real Name
    Brandon
    Join Date
    Jan 2009
    Posts
    1

    Default User input in a calculated field

    Hello, my name is Brandon and I am a Real Estate Appraising Trainee. I'm trying to set up a database for our comparable sales, but I couldnt figure this out. In my database I have a field called Total_Area , I also have fields called FF(Front Footage) and DEPTH. In my old Microsoft Works database I was able to have the Total_Area calculated (FF*DEPTH) if both fields were present, if both fields (FF and DEPTH) did not have any input, Total_Area would not be calculated. But I was always able to user input the total_area regardless of whether or not there was anything in the FF and DEPTH fields. In short, I was wondering if there is an expression or anything I could use to have my total_area field calculated but also a way to where I could override it with user input any time I need. Thanks in advance for any help!!

  2. #2
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: User input in a calculated field

    Brandon:
    Yes and very easily so.
    You would have to have a field in your table to hold the the of the "Area"
    In the field rules->data entry: make this field user entered, then give it a default value: FF*depth. (Assuming you have a field called FF and another called Depth).

    P.S.
    Welcome to the board and good luck with the appraisal business. You might be smarter than most getting in the business at the bottom of the cycle. How do you make comps in a market like this, that's the real challenge.

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

    Default Re: User input in a calculated field

    In A5, a calculated field is always a calculated field - no user input allowed.

    However, you could create OnWrote events for the two footage fields that would save the result IF both were non-zero and the area field was still zero. Something like this:
    Code:
    tc = table.current()
    IF tc.total_area = 0
         ttl_area = tc.ff * tc.depth
         IF ttl_area <> 0
              tc.total_area = ttl_area
         END IF
    END IF
    Since we are in the OnWrote event of a field, (a) it is not necessary to use tc.change_begin()/change_end() and (b) table.current() will always point to the correct table.

    Note that I purposely set this up so that it will NOT overwrite an existing value in the total_area field. You may want to change that - I'll leave that choice up to you. If you don't want that, just remove the outer IF / END IF lines.

    Sorry, I never use action scripting so I'm not sure how this would be done in action scripting other than as in-line xbasic - which is no different than xbasic except that in-line allows you to put other action script commands around the in-line stuff.

    EDIT: Or use Gabriel's method. That works, too. The difference is that a "Default Value" will only work the first time through in Enter mode. If someone comes back later to put in the width and depth measurements, the default will have already been set (presumably to zero) and they will have to enter the total manually.
    Last edited by CALocklin; 01-23-2009 at 04:09 PM.

Similar Threads

  1. User entered calculated field
    By dparkins in forum Alpha Five Version 5
    Replies: 6
    Last Post: 01-19-2007, 05:51 PM
  2. Replies: 5
    Last Post: 10-31-2006, 11:25 AM
  3. switch from calculated field rule to user entered
    By John Fringer in forum Alpha Five Version 6
    Replies: 3
    Last Post: 10-31-2005, 09:14 AM
  4. Prompt for User Input
    By Angelica Morris in forum Alpha Four Version 6 and Prior
    Replies: 4
    Last Post: 11-06-2000, 01:49 PM
  5. User Input
    By Greg Sands Sr. in forum Alpha Five Version 4
    Replies: 1
    Last Post: 04-23-2000, 06:18 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
  •