Alpha Video Training
Results 1 to 6 of 6

Thread: Date from Variable

  1. #1
    Member
    Real Name
    Dwain Fick
    Join Date
    Aug 2003
    Location
    ND
    Posts
    61

    Default Date from Variable

    I would like to use a variable 'vcdate' in the field rules as a calculated value. Can someone enlighten me as to how to do it?

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

    Default RE: Date from Variable

    Can you explain what you are actually trying to accomplish rather than how you are trying to accomplish it?

    From what I read, I have no idea what you are asking. A variable is a variable. It can be calculated based on something but I can't imagine putting both the calculation and the variable in a field rule - one or the other but not both.

  3. #3
    Member
    Real Name
    Dwain Fick
    Join Date
    Aug 2003
    Location
    ND
    Posts
    61

    Default RE: Date from Variable

    Hello Cal,

    Perhaps I've been trying to do this the wrong way.
    I have several tables which require a date which I need to supply. I don't want the system date.
    From my Main Menu,I run a script that Opens one of these tables and also prompts for a date.
    I need to know the technique to have this date automatically fill in a field so I can enter multiple records without re-entering the date for each new record until I exit it. I hope this makes sense to you.

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

    Default RE: Date from Variable

    Dwain,

    An important design decision for you will be whether to populate the date field in new or changed records via field rules or whether to do it in your data entry form. My personal practice is to avoid embedding user supplied variable values in field rules. If the desired value can be computed using an Xbasic expression you don't need a variable. Otherwise, if you're counting on the user to supply a specific value then I wouldn't try to capture that value in a variable and use it in field rules. Instead I'd do it in the data entry form.

    If you declare the variable shared you can use the user supplied value over and over as new records are entered through the form in a single session. Short scripts can be used to automatically assign the user supplied variable value to the date field as new records are entered.

    -- tom

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

    Default RE: Date from Variable

    I think this may solve your problem:

    Use a default for the date and check the "Set default value at start..." box. Here's the default definition:

    PREVIOUS("fld_namef","")

    Where "fld_namef" is the name of the current field (the date field) and needs to be enclosed in quotes just as shown above.

    Using "" as the second argument tells PREVIOUS to use the record number order thus finding the last record that was entered.

    Now you don't even have to prompt for the date AND, if the date changes because all info for date #1 is done and the user is ready to switch to data for date #2, all the user does is change the date on the first record for the "date #2" data. The user changes it once and that becomes the default until it's changed again.

    Look up PREVIOUS in the AlphaFiveHelp.chm for more details.

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

    Default RE: Date from Variable

    By the way, I agree with Tom's comments about using variables in field rules.

    It can be done but it requires a lot of care to make sure you've covered all the possibilities - like what happens if the variable doesn't exist for some reason? Of course, there are always exceptions and there are times you need to do something that isn't "recommended" practice but it sounds like you can avoid potential problems on this one.

Similar Threads

  1. date variable
    By Alan Lee in forum Alpha Five Version 5
    Replies: 1
    Last Post: 02-26-2004, 07:14 PM
  2. variable to date
    By russ Boehle in forum Alpha Five Version 5
    Replies: 7
    Last Post: 02-12-2003, 07:44 AM
  3. Date Variable Search
    By Ken Fleming in forum Alpha Five Version 4
    Replies: 8
    Last Post: 12-07-2002, 08:04 PM
  4. Variable Date in a UI Message Box
    By Dan Blank in forum Alpha Five Version 5
    Replies: 4
    Last Post: 10-09-2002, 10:54 PM
  5. REPORT VARIABLE DATE
    By Arthur Armour in forum Alpha Five Version 4
    Replies: 5
    Last Post: 10-26-2001, 08:16 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
  •