Alpha Video Training
Results 1 to 3 of 3

Thread: Picking a Year for Reports

  1. #1
    Member
    Real Name
    David Theoharides
    Join Date
    May 2000
    Location
    Sanford, Maine
    Posts
    203

    Default Picking a Year for Reports

    I would like to have a way to have a form with a drop-down box that lists all the available years that affect a report. The user would select the year, and then a filter would be created that only prints those years on the report.

    I tried doing this by creating a table with only the years on it. I then tried to use the "on double click" action that would set the Value of the year to a variable called ExpYr. When I try it I get an error of No such field. I have set both of these to numeric.

    Is there a way to make this work??

    Thanks

    Dave

    David Theoharides
    dtheo@sad67.k12.me.us

  2. #2
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,595

    Default RE: Picking a Year for Reports

    David,
    If you are luck enough to have 8 or less available years, you can use the ui_get_list function, as in:
    yr=ui_get_list("YEAR",1,"1995","1996"...)
    then use
    select
    case yr="1995"
    and so on.

    If you have more than 8, check the ui_get_list_array command.

  3. #3
    Jake Vuckovic
    Guest

    Default RE: Picking a Year for Reports

    David, this should work for you.
    Let's assume that you have date field in your table called "year", you can populate dropdown list on a form called Print_dlg and then choose the year from the list.
    Dropdown is based on global variable,character type, call it "year_to_print".

    Create an index (years) based on the date field expression:

    right(dtoc(Year),4)

    and set it to show unique records only.

    Place this script on form's OnInit event:

    dim yr as c
    tbl=Table.current()
    indx=tbl.Index_Primary_Put("years")
    count=indx.records_get()
    'dimension the listbox
    Print_dlg:Dropdown1.choice.list.redim(count)
    'Populate the listbox
    tbl.fetch_first()
    for i=1 to count
    yr = right(dtoc(tbl.year),4)
    Print_dlg:Dropdown1.choice.list[i].text=yr
    Print_dlg:Dropdown1.choice.list[i].value=yr
    tbl.fetch_next()
    next i

    Now, you can design your report and set it's filter like this:

    right(dtoc(Year),4)=Var->Year_to_print

    Make sure that report is not based on current selection of records.

    Good luck,
    Jake

Similar Threads

  1. Filter for report not picking up record
    By Robert Rough in forum Alpha Five Version 6
    Replies: 6
    Last Post: 08-09-2005, 09:17 AM
  2. Picking numbers
    By GregOnline in forum Alpha Five Version 6
    Replies: 2
    Last Post: 06-02-2005, 11:07 AM
  3. Picking Apart A String
    By Louis Nickerson in forum Alpha Five Version 5
    Replies: 8
    Last Post: 08-09-2003, 04:19 PM
  4. Picking Addresses by Date
    By Tom Mills in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-05-2003, 05:08 AM
  5. Nit-picking about a button bitmap
    By Rich Drabik in forum Alpha Five Version 5
    Replies: 4
    Last Post: 10-21-2002, 06:23 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
  •