home *** CD-ROM | disk | FTP | other *** search
- on REFUpdateDatabase
- global searchdata, pageselect, recordsfound, selectiveoptions, REFDatabaseSpriteInfo
- repeat with g = 13 to 15
- if rollOver(g) and the mouseDown then
- if getAt(selectiveoptions, g - 12) = 1 then
- setAt(selectiveoptions, g - 12, 0)
- set the castNum of sprite g to getAt(getAt(REFDatabaseSpriteInfo, g + 3), 1) - 1
- repeat while the mouseDown
- end repeat
- next repeat
- end if
- setAt(selectiveoptions, g - 12, 1)
- set the castNum of sprite g to the castNum of sprite g + 1
- repeat while the mouseDown
- end repeat
- end if
- end repeat
- if pageselect > 0 then
- if rollOver(36) and the mouseDown and (pageselect > 1) then
- set pageselect to pageselect - 1
- buildresultlist()
- displaylist()
- end if
- if rollOver(37) and the mouseDown and (pageselect < (integer(recordsfound / 12) + 1)) then
- set pageselect to pageselect + 1
- buildresultlist()
- displaylist()
- end if
- end if
- end
-
- on PerformSearch
- global resultlist, category, supplier, product, platform, depth, issue, page, contact, selectiveoptions, searchdata
- repeat with g = 27 to 34
- set the locH of sprite g to 2000
- end repeat
- updateStage()
- if searchdata = EMPTY then
- beep()
- put "ENTER SEARCH WORD" into field "category"
- set the locH of sprite 27 to 30
- put " " into field "supplier"
- put " " into field "product"
- put " " into field "platform"
- put " " into field "depth"
- put " " into field "issue"
- put " " into field "page"
- put " " into field "contact"
- updateStage()
- exit
- end if
- set resultlist to list()
- set category to list()
- set supplier to list()
- set product to list()
- set platform to list()
- set depth to list()
- set issue to list()
- set page to list()
- set contact to list()
- makeuppercase()
- if getAt(selectiveoptions, 1) = 1 then
- categorycheck()
- end if
- if getAt(selectiveoptions, 2) = 1 then
- manufacturercheck()
- end if
- if getAt(selectiveoptions, 3) = 1 then
- productcheck()
- end if
- if resultlist = EMPTY then
- beep()
- put "NO MATCH FOUND" into field "category"
- set the locH of sprite 27 to 30
- put "Page 0 of 0" into field "pagexofy"
- put " " into field "supplier"
- put " " into field "product"
- put " " into field "platform"
- put " " into field "depth"
- put " " into field "issue"
- put " " into field "page"
- put " " into field "contact"
- updateStage()
- else
- buildresultlist()
- displaylist()
- end if
- end
-
- on categorycheck
- global searchdata
- set querystring to "UPPER(PRODUCT_CA)='" & searchdata & "'"
- DBQuery(querystring)
- if the result = 0 then
- set resultfound to 1
- repeat while resultfound = 1
- updatelist()
- DBSkip(1)
- if the result <> 0 then
- set resultfound to 0
- end if
- end repeat
- end if
- end
-
- on manufacturercheck
- global searchdata
- set querystring to "UPPER(MANUFACTUR)='" & searchdata & "'"
- put " QUERY STRING ", querystring
- DBQuery(querystring)
- if the result = 0 then
- set resultfound to 1
- repeat while resultfound = 1
- updatelist()
- DBSkip(1)
- if the result <> 0 then
- set resultfound to 0
- end if
- end repeat
- end if
- end
-
- on productcheck
- global searchdata
- set querystring to "UPPER(PRODUCT)='" & searchdata & "'"
- DBQuery(querystring)
- if the result = 0 then
- set resultfound to 1
- repeat while resultfound = 1
- updatelist()
- DBSkip(1)
- if the result <> 0 then
- set resultfound to 0
- end if
- end repeat
- end if
- end
-
- on updatelist
- global resultlist, fieldName, fieldlengths, recordsfound, pageselect
- add(resultlist, [0, 0, 0, 0, 0, 0, 0, 0, 0])
- repeat with j = 1 to count(fieldnames)
- set fname to getAt(fieldnames, j)
- set flength to getAt(fieldlengths, j)
- DBGetFieldByName(fname)
- set fieldcontent to the result
- if fname = "ISSUE" then
- if (value(chars(fieldcontent, 5, 6)) < 1) or (value(chars(fieldcontent, 5, 6)) > 12) then
- nothing()
- else
- set months to list("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
- set monthnumber to value(chars(fieldcontent, 5, 6))
- set newmonthtext to getAt(months, monthnumber) && chars(fieldcontent, 3, 4)
- set fieldcontent to newmonthtext
- end if
- end if
- set datalength to the number of chars in fieldcontent
- if datalength < flength then
- repeat with g = 1 to flength - datalength
- set fieldcontent to fieldcontent & " "
- end repeat
- end if
- if datalength > flength then
- set fieldcontent to chars(fieldcontent, 1, flength)
- end if
- setAt(getAt(resultlist, count(resultlist)), j, fieldcontent)
- end repeat
- set recordsfound to count(resultlist)
- if recordsfound > 12 then
- set pageselect to 1
- set the locH of sprite 36 to 330
- set the locH of sprite 37 to 395
- end if
- end
-
- on buildresultlist
- global resultlist, category, supplier, product, depth, issue, page, contact, pageselect, recordsfound
- repeat with g = 2 to 9
- set the locH of sprite (g + 25) to 2000
- end repeat
- updateStage()
- set category to list()
- set supplier to list()
- set product to list()
- set depth to list()
- set issue to list()
- set page to list()
- set contact to list()
- if pageselect > 0 then
- if (pageselect * 12) < recordsfound then
- repeat with g = (pageselect * 12) - 12 + 1 to pageselect * 12
- add(category, getAt(getAt(resultlist, g), 1) & ":" & getAt(getAt(resultlist, g), 2))
- add(supplier, getAt(getAt(resultlist, g), 3))
- add(product, getAt(getAt(resultlist, g), 4))
- add(depth, getAt(getAt(resultlist, g), 6))
- add(issue, getAt(getAt(resultlist, g), 7))
- add(page, getAt(getAt(resultlist, g), 8))
- add(contact, getAt(getAt(resultlist, g), 9))
- end repeat
- else
- repeat with g = (pageselect * 12) - 12 + 1 to recordsfound
- add(category, getAt(getAt(resultlist, g), 1) & ":" & getAt(getAt(resultlist, g), 2))
- add(supplier, getAt(getAt(resultlist, g), 3))
- add(product, getAt(getAt(resultlist, g), 4))
- add(depth, getAt(getAt(resultlist, g), 6))
- add(issue, getAt(getAt(resultlist, g), 7))
- add(page, getAt(getAt(resultlist, g), 8))
- add(contact, getAt(getAt(resultlist, g), 9))
- end repeat
- end if
- else
- repeat with g = 1 to recordsfound
- add(category, getAt(getAt(resultlist, g), 1) & ":" & getAt(getAt(resultlist, g), 2))
- add(supplier, getAt(getAt(resultlist, g), 3))
- add(product, getAt(getAt(resultlist, g), 4))
- add(depth, getAt(getAt(resultlist, g), 6))
- add(issue, getAt(getAt(resultlist, g), 7))
- add(page, getAt(getAt(resultlist, g), 8))
- add(contact, getAt(getAt(resultlist, g), 9))
- end repeat
- end if
- end
-
- on displaylist
- global category, supplier, product, depth, issue, page, contact, recordsfound, pageselect
- set display to EMPTY
- put EMPTY into field "category"
- repeat with g = 1 to count(category)
- set display to display & getAt(category, g) & RETURN
- end repeat
- put display into field "category"
- set the textSize of member "category" to 9
- set the boxType of member "category" to #fixed
- if the machineType > 200 then
- set the textFont of member "category" to "arial"
- else
- set the textFont of member "category" to "geneva"
- end if
- set display to EMPTY
- put EMPTY into field "supplier"
- repeat with g = 1 to count(supplier)
- set display to display & getAt(supplier, g) & RETURN
- end repeat
- put display into field "supplier"
- set the textSize of member "supplier" to 9
- set the boxType of member "supplier" to #fixed
- if the machineType > 200 then
- set the textFont of member "supplier" to "arial"
- else
- set the textFont of member "supplier" to "geneva"
- end if
- set display to EMPTY
- put EMPTY into field "product"
- repeat with g = 1 to count(product)
- set display to display & getAt(product, g) & RETURN
- end repeat
- put display into field "product"
- set the textSize of member "product" to 9
- set the boxType of member "product" to #fixed
- if the machineType > 200 then
- set the textFont of member "product" to "arial"
- else
- set the textFont of member "product" to "geneva"
- end if
- set display to EMPTY
- put EMPTY into field "depth"
- repeat with g = 1 to count(depth)
- set display to display & getAt(depth, g) & RETURN
- end repeat
- put display into field "depth"
- set the textSize of member "depth" to 9
- set the boxType of member "depth" to #fixed
- if the machineType > 200 then
- set the textFont of member "depth" to "arial"
- else
- set the textFont of member "depth" to "geneva"
- end if
- set display to EMPTY
- put EMPTY into field "issue"
- repeat with g = 1 to count(issue)
- set display to display & getAt(issue, g) & RETURN
- end repeat
- put display into field "issue"
- set the textSize of member "issue" to 9
- set the boxType of member "issue" to #fixed
- if the machineType > 200 then
- set the textFont of member "issue" to "arial"
- else
- set the textFont of member "issue" to "geneva"
- end if
- set display to EMPTY
- put EMPTY into field "page"
- repeat with g = 1 to count(page)
- set display to display & getAt(page, g) & RETURN
- end repeat
- put display into field "page"
- set the textSize of member "page" to 9
- set the boxType of member "page" to #fixed
- if the machineType > 200 then
- set the textFont of member "page" to "arial"
- else
- set the textFont of member "page" to "geneva"
- end if
- set display to EMPTY
- put EMPTY into field "contact"
- repeat with g = 1 to count(contact)
- set display to display & getAt(contact, g) & RETURN
- end repeat
- put display into field "contact"
- set the textSize of member "contact" to 9
- set the boxType of member "contact" to #fixed
- if the machineType > 200 then
- set the textFont of member "contact" to "arial"
- else
- set the textFont of member "contact" to "geneva"
- end if
- if pageselect > 0 then
- put "Page" && pageselect && "of " && integer(recordsfound / 12) + 1 into field "pagexofy"
- else
- put "Page 1 of 1" into field "pagexofy"
- end if
- repeat with g = 2 to 9
- set the locH of sprite (g + 25) to getAt(getAt(REFDatabaseSpriteInfo, g), 2)
- end repeat
- updateStage()
- end
-
- on makeuppercase
- global searchdata
- repeat with g = 1 to the number of chars in searchdata
- put charToNum(char g of searchdata)
- if (charToNum(char g of searchdata) > 96) and (charToNum(char g of searchdata) < 123) then
- set currentasciivalue to charToNum(char g of searchdata)
- set currentasciivalue to currentasciivalue - 32
- put numToChar(currentasciivalue) into char g of searchdata
- end if
- end repeat
- put "new word: " & searchdata
- end
-