Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Script Library

  Find and replace text data in a table
  chubbard posted this script:
  This function searches for a substring in a text field in a table, and replaces all instances of that substring with the specified string. The function takes the name of the table, the name of the RowId column in that table (optional), the name of the column to search, the string to search for, and the string with which to replace it.

webcall function SingleFieldReplace(strTableName, strRowIdName, strColName, strFind, strReplace)
    if(strRowIdName == "")
        strRowIdName = "RowId";

    var aCols = new Array(strRowIdName, strColName);
    var rs = new Resultset(strTableName, aCols, strColName + " LIKE '%" + strFind + "%'");

        //get record text.
        var strText = rs[strColName];
        //find and replace all instances of search string.
        strText = substringReplace(strText, strFind, strReplace);

        //update record.
        var fld = new Object();
        fld[strColName] = strText;
        Table.update(strTableName, fld, rs[strRowIdName]);

public function substringReplace(theString, searchString, replaceString)
    return theString.split(searchString).join(replaceString);
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
Email Us