FUNCTION ChooseFitter(t)
  vloadif(dpath|"ftr_list.vws")
  if t = "v"                           'active fitters
    data query execute "actv_ftr.dfq" index "actv_ftr.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'   [Active]="YES"
'   and
'   not (deleted)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  else
    data query execute "not_del.dfq" index "actv_ftr.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' not (deleted)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  end if

  order sort now dictionary "nickname" fields "[Nickname]" ascending
  while true
    x = bpopdb("ftr_list",5,"","[Nickname]","L8","[Fitter_Name]","L0","[Fitter_Code]",5,35,21,45,"",0)
    if x = -1
      repaint off
      vunloadif("ftr_list.vws")
      return(-1)
    else
      ftrcode   = ptstr                'message "ptstr is:"&str(ptstr)
      $name     = [Fitter_Name]        'message "$name is:"&str($name)
      $nickname = [Nickname]
      ProcessFitter()
      Background()
      vloadif(dpath|"ftr_list.vws")
    end if
  end while
  repaint off
  screen shortrestore dsa
  vunloadif("ftr_list.vws")
  return (-1)
END FUNCTION  ' ChooseFitter()
