Do you find this script useful?
Yes
No
Comments?
DB/Text script to replace Boolean word in DB/Textworks query screen with Boolean symbols.
This script will search for the words AND, OR, or NOT and replace the word with the appropriate Boolean symbol prior to a search.
Script Language: JavaScript For use with:
DB/Textworks
DB/SearchWorks
DB/Text Run-time
Requires at least version 4.0
function onQueryExecute()
{

// This array should contain all the names of the boxes
// on your screen. All names should be enclosed in quotes
// and separated by a comma. Any boxes that are not named
// in the box array will not have a replacement made.

   var boxArray = new Array ("searchBox","nameBox","companyBox","directionsBox");

   contentReplace(boxArray,"AND","&");
   contentReplace(boxArray,"OR","/");
   contentReplace(boxArray,"NOT","!");

}

function contentReplace(boxNameArray, oldText, newText)
{
   var boxContents;
   var newContents;
   var regText = new RegExp(oldText, "g");

   for(i=0;i < boxNameArray.length;i++)
   {
      boxContents = Form.boxes(boxNameArray[i]).content;
      newContents = boxContents.replace(regText,newText);

      Form.boxes(boxNameArray[i]).content = newContents;
   }

}
Notes: The script is case sensitive and will not replace the boolean words unless they are in all upper case.
Directions: Name all the search boxes on you query screen and add the script to the screen. Update the boxArray with the names for your screen and you are done.
Submitted by Inmagic Staff on 4/2/01

Powered by DB/Text WebPublisher, from Inmagic WebPublisher PRO