Alpha Video Training
Results 1 to 9 of 9

Thread: question on DATE

  1. #1
    ken tjia
    Guest

    Default question on DATE

    I have a from where the date field is filled by way of an expression DATE() And for that, it is not accessable during
    normal data entry on the form.

    Once a while, we do want to enter an old date.
    Can anyone suggest a way to accomplish this ?

    * I am thinking a radio buttom placed next to the DATE entry field on the FORM.. TO ask...

    * Enter today's date ?
    * Enter "PAST" Date ?

    And use the variable to determine which way to go ??

    Ken Tjia

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

    Default RE: question on DATE

    Instead of using the field rule to define the field as a calculated field, consider leaving it User Entered.

    Then on the Data Entry tab of field rules for this field, set default mode to "simple expression", and then set default value to date(). You may have to scroll down a bit to see these options.

    This will insert the current date when a record is entered, but will permit you to override the default later on if you wish.

    -- tom

  3. #3
    ken tjia
    Guest

    Default RE: question on DATE

    Thank you Tom,

    That work well come to think about it.

    In a similar area... I am having a bid of challange related to MONTH & YEAR.

    Let me try to describe it carefully to see if you can help me..

    What I have here is a typical "REPAIR-SHOP" application.
    Where PARTS being consummed on the fly.

    Having collected 6 months of data. I am about to "have" to generate some report to show. (SUMMARY REPORT)

    The challange is the USE_BY_DATE field within the table would no doubt have entries range from anywhere in Jan to Jun 2000.

    So I created a field called "MONTH_YEAR)( CHARACTER 20 digits long) to combine the MONTH+YEAR together. The expression I used here

    CMONTH(DATE_OF_USE)+CYEAR(DATE_OF_USE)

    That work out extremely well and all conversion take place on the fly as we are entering the DATE info into the DATE_OF_USE field.

    Then I managed to create a perfect summary and display them in browse mode.... That work very also..

    BUT... The way the conversion taken place. all data in the month of April will be shown as "APRIL2000" etc..

    Because alpha treat is as a character. Sorting take place in which APRIL2000 always on top of the browse's line, follow by AUG1999 etc.. Sure make the viewing a bit uneasy.

    My first wish to see..

    PERIOD QTY

    JAN-2000 50
    FEB-2000 19
    MAR-2000 16 etc...

    But I think for best SORTING PURPOSE>>> I will compromise
    to see

    PERIOD QTY

    01-2000 50
    02-2000 19
    03-2000 16 etc....

    Can you help me ?

    Your assitance in about routine is greatly appreciated.

    Ken Tjia

  4. #4
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default RE: question on DATE

    Ken,

    I think you may want MONTH(DATE_OF_USE)+YEAR(DATE_OF_USE tyo give you a numeric sort order instead of character.

    Michael

  5. #5
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default RE: question on DATE

    Ken,

    You are better served sorting on the datevalue as follows

    LEFT(cdate(datevalue),6)

    This will sort the fields by year and month.


    Regards,

    Ira J. Perlow
    Computer Systems Design & Associates
    csda@mediaone.net

  6. #6
    ken tjia
    Guest

    Default RE: question on DATE

    Ttried that already, but not accepting.

    I forgot what the error was... Just the CMONTH work so far.

    Ken Tjia

  7. #7
    ken tjia
    Guest

    Default RE: question on DATE

    work very well..

    Now I got 200001,200002 etc..

    how can I get 2000-01
    2000-02 (feb 2000)
    2000-03 etc..

    Thank you

    Ken Tjia

  8. #8
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: question on DATE

    Hi Ken,

    Sorry I missed you yesterday. Pretty busy here in Toronto.

    If all you want is to reformat your date in a report then
    left(cdate(datevalue),4)+substr(cdate(datevalue),5,2)
    will yield strings with the format 2000-01, 2000-02 etc.
    cyear(datevalue)+substr(cdate(datevalue),5,2)
    would probably be cleaner but I don't have my alpha5 documentation with me to verify the syntax.

    All of this is ok for calculations on reports and forms but you probably do not want to store the format in a field.

    Talk to you soon,
    Bill

  9. #9
    ken tjia
    Guest

    Default RE: question on DATE

    bill..

    I am still in town and thanks a million for your help.
    Well you know my cell... 416-936-1879

    call me anytime...

    Ken Tjia

Similar Threads

  1. Date fields European style Question
    By René Stout in forum Web Application Server v6
    Replies: 8
    Last Post: 09-26-2004, 09:31 AM
  2. Date question: calculate tuesdays in month
    By Shahin Cassim in forum Alpha Five Version 5
    Replies: 11
    Last Post: 07-15-2003, 09:13 AM
  3. Date Calendar Question
    By Marc King - A5solutions in forum Alpha Five Version 5
    Replies: 6
    Last Post: 01-03-2003, 08:45 AM
  4. Date Change Question
    By forskare in forum Alpha Five Version 4
    Replies: 7
    Last Post: 04-05-2002, 07:40 PM
  5. date validation question
    By eeetee in forum Alpha Five Version 4
    Replies: 3
    Last Post: 05-22-2000, 03:01 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
  •