home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April B / Pcwk4b98.iso / Borland / Dbase50w / MUSIC1.PAK / FILTER.WFM < prev    next >
Text File  |  1994-08-02  |  24KB  |  764 lines

  1. *******************************************************************************
  2. *  PROGRAM:      Filter.wfm
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         1/94
  7. *
  8. *  UPDATED:      6/94
  9. *
  10. *  REVISION:     $Revision:   1.25  $
  11. *
  12. *  VERSION:      dBASE FOR WINDOWS 5.0
  13. *
  14. *  DESCRIPTION:  This form allows setting a filter on the items currently
  15. *                viewed.  It allows you to create a combination filter based
  16. *                on the artist, title, price, release date, and media type
  17. *                of the available items from the Musical Methods store.
  18. *
  19. *  PARAMETERS:   None
  20. *
  21. *  CALLS:        Music.qbe     (view of tables)
  22. *                Music.cc      (for custom pushbuttons)
  23. *
  24. *
  25. *  USAGE:        DO Filter.wfm  && or
  26. *
  27. *                local f
  28. *                set procedure to Filter.wfm additive
  29. *                f = new FilterForm()
  30. *                f.ReadModal
  31. *******************************************************************************
  32. #include <Messdlg.h>
  33. #include "Music.h"
  34. #define EMPTY_OP      "   "
  35. #define EMPTY_LOGIC   "     "
  36. #define EMPTY_STRING  " "
  37. set talk off
  38. set ldcheck off
  39.  
  40. ** END HEADER -- do not remove this line*
  41. * Generated on 05/12/94
  42. *
  43. LOCAL f
  44. f = NEW FILTERFORM()
  45. f.Open()
  46.  
  47. CLASS FILTERFORM OF FORM
  48.    Set Procedure To Music.cc Additive
  49.    this.OnOpen = CLASS::ONOPEN
  50.    this.OnSelection = CLASS::ONSELECTION
  51.    this.OnClose = CLASS::ONCLOSE
  52.    this.MousePointer =          1
  53.    this.ColorNormal = "R/W"
  54.    this.Text = "Set Filter"
  55.    this.Width =         96.64
  56.    this.Top =          2.02
  57.    this.Left =          2.70
  58.    this.Height =         17.17
  59.    this.Minimize = .F.
  60.    this.Maximize = .F.
  61.    this.HelpFile = ""
  62.    this.HelpId = ""
  63.  
  64.  
  65.    DEFINE RECTANGLE MEDIATYPERECT OF THIS;
  66.        PROPERTY;
  67.          ColorNormal "N/W",;
  68.          Text "",;
  69.          Height          2.02,;
  70.          Width         94.61,;
  71.          Top         10.61,;
  72.          Left          0.67,;
  73.          Border .T.
  74.  
  75.    DEFINE RECTANGLE RELEASEDATERECT OF THIS;
  76.        PROPERTY;
  77.          ColorNormal "N/W",;
  78.          Text "",;
  79.          Height          2.02,;
  80.          Width         94.61,;
  81.          Top          8.58,;
  82.          Left          0.67,;
  83.          Border .T.
  84.  
  85.    DEFINE RECTANGLE SALESPRICERECT OF THIS;
  86.        PROPERTY;
  87.          ColorNormal "N/W",;
  88.          Text "",;
  89.          Height          2.02,;
  90.          Width         94.61,;
  91.          Top          6.57,;
  92.          Left          0.67,;
  93.          Border .T.
  94.  
  95.    DEFINE RECTANGLE RANKRECT OF THIS;
  96.        PROPERTY;
  97.          ColorNormal "N/W",;
  98.          Text "",;
  99.          Height          2.02,;
  100.          Width         94.61,;
  101.          Top          4.55,;
  102.          Left          0.67,;
  103.          Border .T.
  104.  
  105.    DEFINE RECTANGLE TITLERECT OF THIS;
  106.        PROPERTY;
  107.          ColorNormal "N/W",;
  108.          Text "",;
  109.          Height          2.02,;
  110.          Width         94.61,;
  111.          Top          2.53,;
  112.          Left          0.67,;
  113.          Border .T.
  114.  
  115.    DEFINE RECTANGLE ARTISTRECT OF THIS;
  116.        PROPERTY;
  117.          ColorNormal "N/W",;
  118.          Text "",;
  119.          Height          2.02,;
  120.          Width         94.61,;
  121.          Top          0.50,;
  122.          Left          0.67,;
  123.          Border .T.
  124.  
  125.    DEFINE NORMALTEXT ARTISTTEXT OF THIS;
  126.        PROPERTY;
  127.          Alignment 5,;
  128.          Text "Artist:",;
  129.          Width         16.22,;
  130.          Top          1.01,;
  131.          Left          1.35,;
  132.          Height          1.01,;
  133.          Border .F.
  134.  
  135.    DEFINE NORMALENTRY ARTISTENTRY OF THIS;
  136.        PROPERTY;
  137.          OnGotFocus CLASS::ONGOTFOCUSFIELD,;
  138.          OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
  139.          Enabled .T.,;
  140.          Width         40.55,;
  141.          Top          1.01,;
  142.          Left         31.08,;
  143.          Height          1.07,;
  144.          Value "                              ",;
  145.          Function "!"
  146.  
  147.    DEFINE COMBOBOX ARTISTOPCOMBO OF THIS;
  148.       PROPERTY;
  149.         Enabled     .F.,;
  150.         Width          8.11,;
  151.         Top          1.01,;
  152.         Left         18.92,;
  153.         Height          1.26,;
  154.         FontSize          7.00,;
  155.         Style          2
  156.  
  157.    DEFINE COMBOBOX ARTISTLOGICCOMBO OF THIS;
  158.       PROPERTY     ;
  159.          Enabled      .F.,;
  160.          Width          10.81,     ;
  161.          Top          1.01,     ;
  162.          Left         72.98,     ;
  163.          Height          1.26,     ;
  164.          Value "",     ;
  165.          Style          2
  166.  
  167.    DEFINE PUSHBUTTON CLEARARTISTBUTTON OF THIS;
  168.        PROPERTY;
  169.          Id 1,;
  170.          OnClick CLASS::CLEARARTIST,;
  171.          Text "Clear",;
  172.          Width          6.76,;
  173.          Top          1.01,;
  174.          Left         86.53,;
  175.          Height          1.01
  176.  
  177.    DEFINE NORMALTEXT TITLETEXT OF THIS;
  178.        PROPERTY;
  179.          Alignment 5,;
  180.          Text "Title:",;
  181.          Width         16.22,;
  182.          Top          3.03,;
  183.          Left          1.35,;
  184.          Height          1.21
  185.  
  186.    DEFINE COMBOBOX TITLEOPCOMBO OF THIS;
  187.       PROPERTY     ;
  188.          Enabled     .F.,;
  189.          Width          8.11,     ;
  190.          Top          3.03,     ;
  191.          Left         18.92,     ;
  192.          Height          1.26,     ;
  193.          Value "",     ;
  194.          Style          2
  195.  
  196.    DEFINE NORMALENTRY TITLEENTRY OF THIS;
  197.        PROPERTY;
  198.          OnGotFocus CLASS::ONGOTFOCUSFIELD,;
  199.          OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
  200.          Enabled .T.,;
  201.          Width         40.55,;
  202.          Top          3.03,;
  203.          Left         31.08,;
  204.          Height          1.07,;
  205.          Value "                              ",;
  206.          Function "!"
  207.  
  208.    DEFINE COMBOBOX TITLELOGICCOMBO OF THIS   ;
  209.       PROPERTY     ;
  210.          Enabled      .F.,;
  211.          Width          10.81,     ;
  212.          Top          3.03,     ;
  213.          Left         72.98,     ;
  214.          Height          1.26,     ;
  215.          Value "",     ;
  216.          Style          2
  217.  
  218.  
  219.    DEFINE PUSHBUTTON CLEARTITLEBUTTON OF THIS;
  220.        PROPERTY;
  221.          Id 2,;
  222.          OnClick CLASS::CLEARTITLE,;
  223.          Text "Clear",;
  224.          Width          6.76,;
  225.          Top          3.03,;
  226.          Left         86.53,;
  227.          Height          1.01
  228.  
  229.    DEFINE NORMALTEXT RANKTEXT OF THIS;
  230.        PROPERTY;
  231.          Alignment 5,;
  232.          Text "Rank:",;
  233.          Width         16.22,;
  234.          Top          5.05,;
  235.          Left          1.35,;
  236.          Height          1.01
  237.  
  238.    DEFINE COMBOBOX RANKOPCOMBO OF THIS;
  239.       PROPERTY     ;
  240.          Enabled     .F.,;
  241.          Width          8.11,     ;
  242.          Top          5.05,     ;
  243.          Left         18.92,     ;
  244.          Height          1.26,     ;
  245.          Value "",     ;
  246.          Style          2
  247.  
  248.    DEFINE SPINBOX RANKSPIN OF THIS;
  249.        PROPERTY;
  250.          OnGotFocus CLASS::ONGOTFOCUSFIELD,;
  251.          OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
  252.          ColorNormal "r/w",;
  253.          Picture "9999",;
  254.          Function "J",;
  255.          Width         13.52,;
  256.          Top          5.05,;
  257.          Left         31.08,;
  258.          Height          1.07,;
  259.          Border .T.,;
  260.          Value          0,;
  261.          Rangemin          0,;
  262.          Rangemax       2500,;
  263.          ColorHighLight "r/w*"
  264.  
  265.  
  266.    DEFINE COMBOBOX RANKLOGICCOMBO OF THIS;
  267.       PROPERTY     ;
  268.          Enabled      .F.,;
  269.          Width          10.81,     ;
  270.          Top          5.05,     ;
  271.          Left         72.98,     ;
  272.          Height          1.26,     ;
  273.          Value "",     ;
  274.          Style          2
  275.  
  276.    DEFINE PUSHBUTTON CLEARRANKBUTTON OF THIS;
  277.        PROPERTY;
  278.          Id 3,;
  279.          OnClick CLASS::CLEARRANK,;
  280.          Text "Clear",;
  281.          Width          6.76,;
  282.          Top          5.05,;
  283.          Left         86.53,;
  284.          Height          1.01
  285.  
  286.    DEFINE NORMALTEXT SALESPRICETEXT OF THIS;
  287.        PROPERTY;
  288.          Alignment 5,;
  289.          Text "Sales Price:",;
  290.          Width         16.22,;
  291.          Top          7.07,;
  292.          Left          1.35,;
  293.          Height          1.01
  294.  
  295.    DEFINE COMBOBOX SALESPRICEOPCOMBO OF THIS;
  296.       PROPERTY     ;
  297.          Enabled     .F.,;
  298.          Width          8.11,     ;
  299.          Top          7.07,     ;
  300.          Left         18.92,     ;
  301.          Height          1.26,     ;
  302.          Value "",     ;
  303.          Style          2
  304.  
  305.    DEFINE SPINBOX SALESPRICESPIN OF THIS;
  306.        PROPERTY;
  307.          OnGotFocus CLASS::ONGOTFOCUSFIELD,;
  308.          OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
  309.          ColorNormal "r/w",;
  310.          Width         13.52,;
  311.          Top          7.07,;
  312.          Left         31.08,;
  313.          Height          1.01,;
  314.          Border .T.,;
  315.          Value          0,;
  316.          Rangemin          1,;
  317.          Rangemax        100,;
  318.          ColorHighLight "r/w*",;
  319.          Picture "999.99",;
  320.          Function "$J"
  321.  
  322.    DEFINE COMBOBOX SALESPRICELOGICCOMBO OF THIS;
  323.       PROPERTY     ;
  324.          Enabled      .F.,;
  325.          Width          10.81,     ;
  326.          Top          7.07,     ;
  327.          Left         72.98,     ;
  328.          Height          1.26,     ;
  329.          Value "",     ;
  330.          Style          2
  331.  
  332.    DEFINE PUSHBUTTON CLEARSALESPRICEBUTTON OF THIS;
  333.        PROPERTY;
  334.          Id 5,;
  335.          OnClick CLASS::CLEARSALESPRICE,;
  336.          Text "Clear",;
  337.          Width          6.76,;
  338.          Top          7.07,;
  339.          Left         86.53,;
  340.          Height          1.01
  341.  
  342.    DEFINE NORMALTEXT RELEASEDATETEXT OF THIS;
  343.        PROPERTY;
  344.          Alignment 5,;
  345.          Text "Release Date:",;
  346.          Width         16.22,;
  347.          Top          9.09,;
  348.          Left          1.35,;
  349.          Height          1.01
  350.  
  351.    DEFINE COMBOBOX RELEASEDATEOPCOMBO OF THIS;
  352.       PROPERTY     ;
  353.          Enabled     .F.,;
  354.          Width          8.11,     ;
  355.          Top          9.09,     ;
  356.          Left         18.92,     ;
  357.          Height          1.26,     ;
  358.          Value "",     ;
  359.          Style          2
  360.  
  361.    DEFINE ENTRYFIELD RELEASEDATEENTRY OF THIS;
  362.        PROPERTY;
  363.          OnGotFocus CLASS::ONGOTFOCUSFIELD,;
  364.          OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
  365.          ColorNormal "r/w",;
  366.          Width         13.52,;
  367.          Top          9.09,;
  368.          Left         31.08,;
  369.          Height          1.07,;
  370.          Border .T.,;
  371.          Value {  / /  },;
  372.          ColorHighLight "r/w*",;
  373.          Function "DJ"
  374.  
  375.    DEFINE COMBOBOX RELEASEDATELOGICCOMBO OF THIS;
  376.       PROPERTY     ;
  377.          Enabled      .F.,;
  378.          Width          10.81,     ;
  379.          Top          9.09,     ;
  380.          Left         72.98,     ;
  381.          Height          1.26,     ;
  382.          Value "",     ;
  383.          Style          2
  384.  
  385.    DEFINE PUSHBUTTON CLEARRELEASEDATEBUTTON OF THIS;
  386.        PROPERTY;
  387.          Id 4,;
  388.          OnClick CLASS::CLEARRELEASEDATE,;
  389.          Text "Clear",;
  390.          Width          6.76,;
  391.          Top          9.09,;
  392.          Left         86.53,;
  393.          Height          1.01
  394.  
  395.  
  396.    DEFINE NORMALTEXT MEDIATYPETEXT OF THIS;
  397.        PROPERTY;
  398.          Alignment 5,;
  399.          Text "Media Type:",;
  400.          Width         16.22,;
  401.          Top         11.11,;
  402.          Left          1.35,;
  403.          Height          1.21
  404.  
  405.  
  406.    DEFINE COMBOBOX MEDIATYPEOPCOMBO OF THIS;
  407.       PROPERTY     ;
  408.          Enabled     .F.,;
  409.          Width          8.11,     ;
  410.          Top         11.11,     ;
  411.          Left         18.92,     ;
  412.          Height          1.26,     ;
  413.          Value "",     ;
  414.          Style          2
  415.  
  416.  
  417.    DEFINE COMBOBOX MEDIATYPECOMBO OF THIS;
  418.       PROPERTY;
  419.          OnGotFocus CLASS::ONGOTFOCUSFIELD,;
  420.          OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
  421.          Width         40.55,;
  422.          Top         11.11,;
  423.          Left         31.08,;
  424.          Height          1.26,;
  425.          Value " ",;
  426.          Style          2
  427.  
  428.    DEFINE PUSHBUTTON CLEARMEDIATYPEBUTTON OF THIS;
  429.        PROPERTY;
  430.          Id 6,;
  431.          OnClick CLASS::CLEARMEDIATYPE,;
  432.          Text "Clear",;
  433.          Width          6.76,;
  434.          Top         11.11,;
  435.          Left         86.53,;
  436.          Height          1.01
  437.  
  438.    DEFINE IMAGE LOGOIMAGE OF THIS;
  439.        PROPERTY;
  440.          Width          10.81,;
  441.          Top         13.13,;
  442.          Left         1.35,;
  443.          Height          3.03,;
  444.          DataSource "FILENAME SMLMUSIC.BMP"
  445.  
  446.    DEFINE OKBUTTON FILTEROKBUTTON OF THIS;
  447.        PROPERTY;
  448.          Width        14.11,;
  449.          Top         14.14,;
  450.          Left         64.87,;
  451.          Height          1.50,;
  452.          Default .T.,;
  453.          Group .T.
  454.  
  455.    DEFINE CANCELBUTTON FILTERCANCELBUTTON OF THIS;
  456.        PROPERTY;
  457.          Width        14.11,;
  458.          Top         14.14,;
  459.          Left         79.74,;
  460.          Height          1.50,;
  461.          ID          0,;
  462.          Group .F.
  463.  
  464.  
  465. *******************************************************************************
  466. procedure OnOpen
  467. *******************************************************************************
  468. this.saveExact = set("exact")
  469. this.saveFields = setto("fields")
  470. setSkip = "Music"
  471. if empty(alias())
  472.    set view to  Music.qbe
  473. endif
  474. use configs again in select() alias configs2 order descript
  475. set exact off
  476. set fields to
  477. set skip to &setSkip
  478.  
  479. this.CreateArrays()
  480.  
  481. this.mediaTypeCombo.dataSource = "array form.configsAr"
  482. this.artistOpCombo.dataSource = "array form.charOpAr"
  483. this.titleOpCombo.dataSource = "array form.charOpAr"
  484. this.rankOpCombo.dataSource = "array form.operatorAr"
  485. this.salesPriceOpCombo.dataSource = "array form.operatorAr"
  486. this.releaseDateOpCombo.dataSource = "array form.operatorAr"
  487. this.mediaTypeOpCombo.dataSource = "array form.charOpAr"
  488. this.artistLogicCombo.dataSource = "array form.logicOpAr"
  489. this.titleLogicCombo.dataSource = "array form.logicOpAr"
  490. this.rankLogicCombo.dataSource = "array form.logicOpAr"
  491. this.salesPriceLogicCombo.dataSource = "array form.logicOpAr"
  492. this.releaseDateLogicCombo.dataSource = "array form.logicOpAr"
  493.  
  494. this.artistEntry.prevObj     = this.artistOpCombo
  495. this.titleEntry.prevObj      = this.titleOpCombo
  496. this.rankSpin.prevObj        = this.rankOpCombo
  497. this.salesPriceSpin.prevObj  = this.salesPriceOpCombo
  498. this.releaseDateEntry.prevObj = this.releaseDateOpCombo
  499. this.mediaTypeCombo.prevObj  = this.mediaTypeOpCombo
  500.  
  501. this.artistEntry.nextObj     = this.artistLogicCombo
  502. this.titleEntry.nextObj      = this.titleLogicCombo
  503. this.rankSpin.nextObj        = this.rankLogicCombo
  504. this.salesPriceSpin.nextObj  = this.salesPriceLogicCombo
  505. this.releaseDateEntry.nextObj = this.releaseDateLogicCombo
  506. this.mediaTypeCombo.nextObj  = this.mediaTypeCombo.prevObj  && no combobox
  507.                                                             && after media types
  508. *******************************************************************************
  509. procedure OnClose
  510. *******************************************************************************
  511. private saveExact, saveFields
  512. set skip to
  513. saveExact = this.saveExact
  514. saveFields = this.saveFields
  515. set exact &saveExact
  516. set fields to &saveFields
  517. use in configs2                     && Close temporary configs table
  518.  
  519. *** If form is not opened modally
  520. if _app.framewin.text = "Musical Methods"
  521.    this.viewForm.filter = set("filter")
  522. endif
  523.  
  524.  
  525. *******************************************************************************
  526. procedure OnGotFocusField
  527. *******************************************************************************
  528. if empty(this.prevObj.value)
  529.    this.prevObj.value = " is "
  530. endif
  531. if .not. empty(this.nextObj) .and. empty(this.nextObj.value)
  532.    this.nextObj.value = "and"
  533. endif
  534.  
  535. *******************************************************************************
  536. procedure OnLostFocusField
  537. *******************************************************************************
  538. if empty(this.value)                && Nothing was entered
  539.    this.nextObj.value = " "
  540.    this.nextObj.enabled = .f.
  541.    this.prevObj.value = "     "
  542.    this.prevObj.enabled = .f.
  543. else                                && Enable comboboxes if they exist
  544.    if .not. empty(this.nextObj)     && (MediaTypeCombo doesn't have nextObj)
  545.       this.nextObj.enabled = .t.
  546.       if empty(this.nextObj.value)
  547.          this.nextObj.value = "and"
  548.       endif
  549.    endif
  550.    this.prevObj.enabled = .t.
  551.    if empty(this.prevObj.value)     && if no operator, assign one
  552.       this.prevObj.value = " is  "
  553.    endif
  554. endif
  555.  
  556.  
  557. *******************************************************************************
  558. procedure CreateArrays
  559. *******************************************************************************
  560. local arrayRef  && variable for minimizing property access
  561.  
  562. * combobox datasource arrays
  563. this.operatorAr = new array(5)
  564. this.charOpAr = new array(3)
  565. this.logicOpAr  = new array(3)
  566. this.configsAr  = new array(reccount("configs2") + 1)  && add 1 for empty value
  567.  
  568. arrayRef = this.operatorAr
  569. arrayRef[1] = "     "
  570. arrayRef[2] = " is  "
  571. arrayRef[3] = "isn't"
  572. arrayRef[4] = "<    "
  573. arrayRef[5] = ">    "
  574.  
  575. acopy(this.operatorAr,this.charOpAr,1,3)  && only want "is" and "isn't"
  576.  
  577. arrayRef = this.logicOpAr
  578. arrayRef[1] = "   "
  579. arrayRef[2] = "and"
  580. arrayRef[3] = "or "
  581.  
  582. arrayRef = this.configsAr
  583. arrayRef[1] = " "
  584. arrayRef[2] = '12" VINYL'
  585. arrayRef[3] = "COMPACT DISC"
  586. arrayRef[4] = "VHS VIDEO"
  587. arrayRef[5] = "CASSETTE"
  588. arrayRef[6] = "DIGITAL COMPACT CASSETTE"
  589. arrayRef[7] = '12" LASER DISC'
  590. arrayRef[8] = "MINI-DISC"
  591. arrayRef[9] = "ACCESSORIES"
  592.  
  593. *******************************************************************************
  594. Procedure OnSelection(controlId)
  595. *******************************************************************************
  596. private filterVar, strConfig, saveFilter, saveRec, closeForm, curTable
  597. form.selectedId = controlId     && Indicates to calling procedure what
  598. closeForm = .f.
  599. curTable = alias()
  600. do case                         && control was selected
  601.    case controlId > 0  && Clear buttons were selected -- don't do anything
  602.    case controlId = 0  && Cancel was selected
  603.       closeForm = .t.
  604.    otherwise
  605.       filterVar = ""
  606.       if .not. empty(this.artistEntry.value)   && Artist was entered
  607.          filterVar = " Music->Artist " +;
  608.                      this.DecodeOp(this.artistOpCombo) +;
  609.                      '"' + ALLTRIM(this.artistEntry.value) + '"' +;
  610.                      this.DecodeOp(this.artistLogicCombo)
  611.       endif
  612.       if .not. empty(this.titleEntry.value)    && Title was entered
  613.          filterVar = filterVar + " Music->Title " +;
  614.                         this.DecodeOp(this.titleOpCombo) +;
  615.                         '"' + ALLTRIM(this.titleEntry.value) + '"' +;
  616.                         this.DecodeOp(this.titleLogicCombo)
  617.       endif
  618.       if .not. empty(this.rankSpin.value)      && Rank was entered
  619.          filterVar = filterVar + " Music->Rank " +;
  620.                         this.DecodeOp(this.rankOpCombo) +;
  621.                         str(this.rankSpin.value,4) +;
  622.                         this.DecodeOp(this.rankLogicCombo)
  623.       endif
  624.       if .not. empty(this.salesPriceSpin.value) && Sales Price was entered
  625.          filterVar = filterVar + " Music->List_Price " +;
  626.                         this.DecodeOp(this.salesPriceOpCombo) +;
  627.                         stuff(str(this.salesPriceSpin.value,6,2),4,1,".") +;
  628.                         this.DecodeOp(this.salesPriceLogicCombo)
  629.       endif
  630.       if .not. empty(this.releaseDateEntry.value) && Release Date was entered
  631.          filterVar = filterVar + " Music->Street_Dt " +;
  632.                         this.DecodeOp(this.releaseDateOpCombo) +;
  633.                         "ctod('" +dtoc(this.releaseDateEntry.value) + "')" +;
  634.                         this.DecodeOp(this.ReleaseDateLogicCombo)
  635.       endif
  636.       if .not. empty(this.mediaTypeCombo.value) && Media Type was specified
  637.          select configs2
  638.          seek this.mediaTypeCombo.value
  639.          strConfig = str(configs2->config)
  640.          select &curTable
  641.          filterVar = filterVar + " Music->Config " +;
  642.                         this.DecodeOp(this.mediaTypeOpCombo) +;
  643.                         strConfig
  644.       endif
  645.       * If last word was .and./.or., delete it
  646.       if CLASS::BackRat(" .or.  ",filterVar) = 7 .or.;
  647.                                         CLASS::BackRat(" .and. ",filterVar) = 7
  648.          filterVar = substr(filterVar,1,len(filterVar) - 7)
  649.       endif
  650.       saveRec = iif(eof(), recno() - 1, recno())
  651.       saveFilter = set("filter")
  652.  
  653.       select music
  654.       set filter to &filterVar
  655.       go top
  656.  
  657.       select &curTable
  658.       set filter to &filterVar
  659.       go top
  660.  
  661.       if eof()                           && no matching records
  662.          set filter to &saveFilter
  663.          go top
  664.          go saveRec
  665.          if ConfirmationMessage("No matching data was found. Continue?",;
  666.                                 "Sorry") = NO
  667.             closeForm = .t.
  668.          endif
  669.       else       && matching records
  670.          form.filter = filterVar
  671.          if type("form.viewForm") <> "U"
  672.             form.viewForm.filter = filterVar   && Save filter in view form
  673.          endif
  674.          closeForm = .t.
  675.       endif
  676. endcase
  677. if closeForm
  678.    form.Close()
  679. endif
  680.  
  681.  
  682. *******************************************************************************
  683. procedure DecodeOp(opControl)
  684. *******************************************************************************
  685. private op,decodedOp
  686. op = opControl.value
  687. decodedOp = op         && some are directly transferable, but
  688. do case                && the case statement handles ones that aren't
  689.    case op = " is "
  690.       decodedOp =     " =  "
  691.    case op = "isn't"
  692.       decodedOp =     " <> "
  693.    case op = "and"
  694.       decodedOp =     " .and. "
  695.    case op = "or "
  696.       decodedOp =     " .or.  "
  697. endcase
  698. return decodedOp
  699.  
  700. *******************************************************************************
  701. Procedure ClearArtist
  702. *******************************************************************************
  703. form.artistOpCombo.value    = EMPTY_OP
  704. form.artistEntry.value      = space(30)
  705. form.artistLogicCombo.value = EMPTY_LOGIC
  706. form.artistEntry.OnLostFocus()
  707.  
  708. *******************************************************************************
  709. Procedure ClearTitle
  710. *******************************************************************************
  711. form.titleOpCombo.value    = EMPTY_OP
  712. form.titleEntry.value      = space(30)
  713. form.titleLogicCombo.value = EMPTY_LOGIC
  714. form.titleEntry.OnLostFocus()
  715.  
  716. *******************************************************************************
  717. Procedure ClearRank
  718. *******************************************************************************
  719. form.rankOpCombo.value    = EMPTY_OP
  720. form.rankSpin.value       = 0
  721. form.rankLogicCombo.value = EMPTY_LOGIC
  722. form.rankSpin.OnLostFocus()
  723.  
  724. *******************************************************************************
  725. Procedure ClearSalesPrice
  726. *******************************************************************************
  727. form.salesPriceOpCombo.value    = EMPTY_OP
  728. form.salesPriceSpin.value       = 0
  729. form.salesPriceLogicCombo.value = EMPTY_LOGIC
  730. form.salesPriceSpin.OnLostFocus()
  731.  
  732. *******************************************************************************
  733. Procedure ClearReleaseDate
  734. *******************************************************************************
  735. form.releaseDateOpCombo.value    = EMPTY_OP
  736. form.releaseDateEntry.value       = {//}
  737. form.releaseDateLogicCombo.value = EMPTY_LOGIC
  738. form.releaseDateEntry.OnLostFocus()
  739.  
  740. *******************************************************************************
  741. Procedure ClearMediaType
  742. *******************************************************************************
  743. form.mediaTypeOpCombo.value = EMPTY_OP
  744. form.mediaTypeCombo.value   = " "
  745. form.mediaTypeCombo.OnLostFocus()
  746.  
  747.  
  748. ***********************************************************
  749. function BackRat(searchStr, targetStr)
  750. **********************************************************
  751. local lenTarget, lenSearch, foundLoc
  752. lenTarget = len(targetStr)
  753. lenSearch = len(searchStr)
  754. foundLoc = rat(searchStr, targetStr)
  755. return iif(foundLoc = 0,;
  756.            0,;
  757.            lenTarget - foundLoc + 1)
  758.  
  759. ENDCLASS
  760.  
  761.  
  762.  
  763.  
  764.