home *** CD-ROM | disk | FTP | other *** search
/ What PC? 1997 December / WPCDEC97.ISO / DXRS / INXWDEC.DXR / 00034_CDXWordSearching.ls < prev    next >
Encoding:
Text File  |  1997-10-13  |  4.5 KB  |  119 lines

  1. on CDXWordSearching
  2.   global CDXWordsearchdata, CDXSomething, CDXWhichTypesList, WhichINXtypenamesList, CDXWhichIndex
  3.   CDXmakeuppercase()
  4.   set CDXNumRepeat to 1
  5.   set whichPos to 1
  6.   case CDXWhichIndex of
  7.     1:
  8.       set querystring to "UPPER(CD_PROD)='" & CDXWordsearchdata & "'"
  9.     2:
  10.       set querystring to "UPPER(MG_PROD)='" & CDXWordsearchdata & "'"
  11.   end case
  12.   DBQuery(querystring)
  13.   set NoGood to 1
  14.   set CDXSomething to 0
  15.   set NoFoundis to 1
  16.   if the result = 0 then
  17.     set resultfound to 1
  18.     repeat while resultfound = 1
  19.       CDXAnimate()
  20.       if (CDXWhichIndex = 2) and (count(CDXWhichTypesList) > 0) then
  21.         repeat with d = 1 to count(CDXWhichTypesList)
  22.           set whichList to getAt(CDXWhichTypesList, d)
  23.           if getAt(whichList, 1) = "MG_RATE" then
  24.             set WhichRate to getAt(whichList, 2)
  25.             set CDXNumRepeat to integer(5 - WhichRate + 1)
  26.             set whichPos to d
  27.             if whichPos <> 1 then
  28.               deleteAt(CDXWhichTypesList, whichPos)
  29.               addAt(CDXWhichTypesList, 1, whichList)
  30.             end if
  31.             exit repeat
  32.           end if
  33.         end repeat
  34.       end if
  35.       if CDXNumRepeat > 1 then
  36.         set CDXWhichTypesListTemp to value(string(CDXWhichTypesList))
  37.         set starthere to getAt(getAt(CDXWhichTypesListTemp, 1), 2)
  38.         repeat with a = 1 to CDXNumRepeat
  39.           setAt(getAt(CDXWhichTypesListTemp, 1), 2, integer(starthere + (a - 1)))
  40.           repeat with z = 1 to count(CDXWhichTypesListTemp)
  41.             set SecondList to getAt(CDXWhichTypesListTemp, z)
  42.             if DBGetFieldByName(getAt(SecondList, 1)) <> getAt(SecondList, 2) then
  43.               set NoGood to 0
  44.               exit repeat
  45.             end if
  46.           end repeat
  47.           if NoGood = 1 then
  48.             set CDXSomething to 1
  49.             put "found:" && NoFoundis into field "CDnoFound"
  50.             set NoFoundis to 1 + NoFoundis
  51.             CDXUpdateList()
  52.             next repeat
  53.           end if
  54.           set NoGood to 1
  55.         end repeat
  56.       else
  57.         if count(CDXWhichTypesList) > 0 then
  58.           repeat with z = 1 to count(CDXWhichTypesList)
  59.             set SecondList to getAt(CDXWhichTypesList, z)
  60.             if DBGetFieldByName(getAt(SecondList, 1)) <> getAt(SecondList, 2) then
  61.               set NoGood to 0
  62.               exit repeat
  63.             end if
  64.           end repeat
  65.         end if
  66.       end if
  67.       if (NoGood = 1) and (CDXNumRepeat = 1) then
  68.         put "here"
  69.         set CDXSomething to 1
  70.         put "found:" && NoFoundis into field "CDnoFound"
  71.         set NoFoundis to 1 + NoFoundis
  72.         CDXUpdateList()
  73.       else
  74.         set NoGood to 1
  75.       end if
  76.       DBSkip(1)
  77.       if the result <> 0 then
  78.         set resultfound to 0
  79.       end if
  80.     end repeat
  81.   end if
  82.   if CDXSomething = 0 then
  83.     put EMPTY into field "CDNothingfound"
  84.     put "Nothing found for:" into line 1 of field "CDNothingfound"
  85.     put ".................................................................." into line 2 of field "CDNothingfound"
  86.     put "Name:" && CDXWordsearchdata into line 3 of field "CDNothingfound"
  87.     repeat with t = 1 to count(CDXWhichTypesList)
  88.       set Whichfield to getAt(getAt(CDXWhichTypesList, t), 1)
  89.       repeat with a = 1 to count(WhichINXtypenamesList)
  90.         if getAt(getAt(WhichINXtypenamesList, a), 1) = Whichfield then
  91.           set Whichfield to getAt(getAt(WhichINXtypenamesList, a), 2)
  92.           exit repeat
  93.         end if
  94.       end repeat
  95.       put Whichfield & ":" && getAt(getAt(CDXWhichTypesList, t), 2) into line t + 3 of field "CDNothingfound"
  96.     end repeat
  97.     set the boxType of member "CDNothingfound" to #adjust
  98.     set the textSize of member "CDNothingfound" to 12
  99.     set the margin of member "CDNothingfound" to 2
  100.     set the border of member "CDNothingfound" to 1
  101.     if the machineType > 200 then
  102.       set the textFont of member "CDNothingfound" to "arial"
  103.     else
  104.       set the textFont of member "CDNothingfound" to "Geneva"
  105.     end if
  106.     set the textStyle of line 1 of member "CDNothingfound" to "bold"
  107.     repeat with t = 3 to the lineCount of member "CDNothingfound"
  108.       set the textStyle of word 1 of line t of member "CDNothingfound" to "bold"
  109.       set the textStyle of word 2 of line t of member "CDNothingfound" to "plain"
  110.     end repeat
  111.     updateStage()
  112.     set the castNum of sprite 34 to the number of member "CDNothingfound"
  113.     set the loc of sprite 34 to point(30, 134)
  114.     set the castNum of sprite 35 to the number of member "NothingGraphic"
  115.     set the loc of sprite 35 to point(217, 156)
  116.     updateStage()
  117.   end if
  118. end
  119.