Alpha Video Training
Results 1 to 6 of 6

Thread: Date Prompt Using 2 Date Fields

  1. #1
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default Date Prompt Using 2 Date Fields

    Has anyone ever used a date prompt using a date field in 2 tables instead of one date field in one table?

    If so, how'd did you do it?

    kenn

  2. #2
    "Certified" Alphaholic
    Real Name
    Charlie Crimmel
    Join Date
    Apr 2000
    Location
    West Virginia
    Posts
    1,695

    Default RE: Date Prompt Using 2 Date Fields

    Ken:
    if your form or report is based on a set, then you could run a date variable script for date1 and date2 and then use a filter in the report something like:

    'Date script 1
    ''XBasic
    DIM date1 AS D
    date_string = ui_get_date("date1", "Enter Beginning Date for Selection",DTOC(Date()))
    If date_string "" THEN
    date1 = CTOD(date_string)
    End If

    'Date script 2
    ''XBasic
    DIM date2 AS D
    date_string = ui_get_date("date2", "Enter Ending Date for Selection",DTOC(Date()))
    If date_string "" THEN
    date2 = CTOD(date_string)
    End If

    'Filter for report
    field1=var->date1 .and. field2=var->date
    ' or another way
    field1>=var->date1 .and. field1 date2 .and.
    field2>=var->date1 .and. field2 date2

    Charlie Crimmel

  3. #3
    Volunteer Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,783

    Default RE: Date Prompt Using 2 Date Fields

    Hi Kenn:

    Could you give a little more detail as to what you are attempting to do?

    Gary

  4. #4
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default RE: Date Prompt Using 2 Date Fields

    Hi Charlie,

    I've been reviewing you suggestion. However, there needs to be a begin and end date for both date fields. I think that will be a nightmare so perhaps it will be much easier to approach it from a different perspective.

    Thanks for your suggestion. I appreciate your time.

    kenn

  5. #5
    "Certified" Alphaholic
    Real Name
    Charlie Crimmel
    Join Date
    Apr 2000
    Location
    West Virginia
    Posts
    1,695

    Default RE: Date Prompt Using 2 Date Fields

    ken:
    just 2 more date scripts.
    Date3 and Date4

    'Date script 1
    ''XBasic
    DIM date1 AS D
    date_string = ui_get_date("date1", "Enter Beginning Date for Selection",DTOC(Date()))
    If date_string "" THEN
    date1 = CTOD(date_string)
    End If

    'Date script 2
    ''XBasic
    DIM date2 AS D
    date_string = ui_get_date("date2", "Enter Ending Date for Selection",DTOC(Date()))
    If date_string "" THEN
    date2 = CTOD(date_string)
    End If
    'Date script 3
    ''XBasic
    DIM date3 AS D
    date_string = ui_get_date("date3", "Enter Beginning Date for Selection",DTOC(Date()))
    If date_string "" THEN
    date3 = CTOD(date_string)
    End If
    'Date script 4
    ''XBasic
    DIM date4 AS D
    date_string = ui_get_date("date4", "Enter Ending Date for Selection",DTOC(Date()))
    If date_string "" THEN
    date4 = CTOD(date_string)
    End If


    field1>=var->date1 .and. field1 date2 .and.
    field2>=var->date3 .and. field2 date4

    Charlie Crimmel

  6. #6
    Volunteer Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,783

    Default RE: Date Prompt Using 2 Date Fields

    Kenn:

    I am not quite sure what you are looking to do, but if I understand correctly, here is something that will work:

    Create a form based on any table (even a dummy table). Define 2 layout date variables, called say date1 and date 2. Go into form properties, and define each as Record List - Combo box. Go to the choices tab - from here, you can specify which table to pull your date from. For the date1 field, specify one table. For the the date2 field, specify the other table. Be sure to check the option 'Display only unique keys.'

    Then, of course, you can use these values in reports quite easily. For example, you could put the following code in the OnExit event of the form you just created, or in a button that you press to Print for example:

    dim global start_date as d
    dim global end_date as d
    start_date=date1.value
    end_date=date2.value

    In the report designer, you could put the following filter in Detail Properties:

    between(date,start_date,end_date)

    I hope this is what you were asking. Let me know.

    Gary

Similar Threads

  1. date fields
    By mike garcia in forum Alpha Five Version 6
    Replies: 3
    Last Post: 06-21-2005, 07:15 AM
  2. Prompt for a Date bug?
    By Mike Vance in forum Alpha Five Version 6
    Replies: 8
    Last Post: 03-04-2005, 06:56 AM
  3. Date fields and LQO
    By Mattyau in forum Alpha Five Version 5
    Replies: 7
    Last Post: 04-02-2004, 05:10 AM
  4. Date Fields
    By Judith Donoghue in forum Alpha Four Versions 7 and 8
    Replies: 2
    Last Post: 11-04-2003, 07:28 AM
  5. Date prompt
    By WFaber in forum Alpha Five Version 5
    Replies: 4
    Last Post: 09-30-2002, 08:49 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
  •