Search these areas:
Help
Support Forums
Product Info



Introduction
DataWeb: What's New
Creating an Application
The DataWeb Designer
Application Management
Data Tables
Data Tables
Views
Templates
Components
Data Analysis
Members
Security
Importing
Exporting
FTP
JavaScript
Object Model
JavaScript Objects
General Scripting Objects
Data Access Objects
cmdDelete Object
cmdInsert Object
cmdSelect Object
cmdUpdate Object
-execute
-getFields
-getFilter
-getTablename
-setFields
-setFilter
Data Access Method Arguments
Field Object
Fields Collection
Index Object
Indexes Collection
previous Object
record Object
Resultset Object
Table Object
Tables Collection
TextImporter Object
Settings Object
View Object
Web Object
File Access Objects
Http Client Objects
Security and Membership Objects
Document Object Model (DOM)
Error Descriptions
Object Model Extensions
Full-Text Search
Domain and Email Hosting
HotBlock Modules
Account Management
Glossary
New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

DataWeb User's Guide

cmdUpdate.setFilter()
Syntax

cmdUpdate.setFilter(filter)

Arguments Description
filter Sets the filter for the cmdUpdate object, overwriting any prior filter setting. An exception is thrown if an invalid filter is provided.

Returns

Return value is undefined.

Description

The setFilter() method specifies the filter to be used by the cmdUpdate.execute()method. The filter is used to designate which portion of the data table are affected by an update. The filter can be an object, object literal, or use filter string syntax to denote whole columns or just portions of columns. To review filter syntax, see the link above.

Example

The following three examples demonstrate three different ways of specifying the filter argument for the setFilter() method. The first example uses an object to set the filter, the second uses an object literal, and the third uses a string. To review filter syntax see the discussion in Data Access Method Arguments.
    //Example #1: This example uses an object to 
    //update the Email field for records where 
    //the LastName field has the value "Smith" 
    //and the FirstName field has the value "Mary".
  var upd = new cmdUpdate("AddressBook"); 
  var filt = new Object();
  filt.LastName = "Smith";
  filt.FirstName = "Mary";
  upd.setFilter(filt);
  upd.setFields({Email:"marysmith@address.com"});
  upd.execute();

    //Example #2: This example uses an object literal 
    //to update the Email field for records where 
    //the LastName field has the value "Smith" 
    //and the FirstName field has the value "Mary".
  var upd = new cmdUpdate("AddressBook");
  upd.setFilter({LastName:"Smith", FirstName:"Mary"});
  upd.setFields({Email:"marysmith@address.com"});
  upd.execute();

    //Example #3: This example use a string to update 
    //the Email field for records where 
    //the LastName field has the value "Smith" 
    //and the FirstName field has the value "Mary".
  var upd = new cmdUpdate("AddressBook");
  upd.setFilter("FirstName = 'Mary' AND LastName = 'Smith'");
  upd.setFields({Email:"marysmith@address.com"});
  upd.execute();


Related Topics

cmdUpdate Object, cmdUpdate.getFilter(), cmdUpdate.execute()
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
Email Us