WebService Functions

The functions listed in this section query, update, delete, and insert a records in the current project database. These functions are:

Get Record Functions

Get Records Functions

Update Record Functions

Insert and Delete Record Functions

SQL Functions

Workflow Rule Functions

Utility Functions

The \SmartClient\acad\afm_samples.lsp file contains examples of using the WebService functions.

All WebService methods have a fixed list of parameters. Even though the number of parameters is fixed, certain parameter values are optional, and for those parameters a value of nil can be used to indicate no value. Each of the functions described in this section state whether a value must be set for a parameter (required) or if a nil value can be set instead for optional parameters (optional) .

The DataRecord Object

The WebService DataRecord is the common container for all data that originates from the Web Central server. This DataRecord object is used for all Record-related data internally within the Smart Client Extension applications, as well as by javascript for server-side View development.

This DataRecord object is exposed through the AutoLISP API as lists of field-value pairs and is identified as a ‘Record’ in this documentation. The ‘Record’ object must be in the following form:

(
("fieldList" ("tableName.fieldName0" . value0) ("tableName.fieldName1" . value1) etc..)
("oldFieldList" ("tableName.fieldName0" . value0) ("tableName.fieldName2" . value2) etc..)
)

This is used when querying, updating, or inserting data through the exposed WebService functions. The first item in each list fieldList and oldFieldList are required fixed values.

Note: Values must be of the correct data type for the specified field name, such as:

(“rm.rm_id” . “101”)
(“rm.area” . 155.89)

There are a series of utility functions that aid in working with these Record objects, which are described in the "Utility Functions" section of this document.

Example

The following is an example of a record that would be used in a call to WebServicesUpdateRecord in which the “rm.rm_std” value is to be updated server-side.

(
("fieldList" ("rm.bl_id" . "HQ") ("rm.fl_id" . "17") ("rm.rm_id" . "101") ("rm.rm_std" . "OFFICE"))
("oldFieldList" ("rm.bl_id" . "HQ") ("rm.fl_id" . "17") ("rm.rm_id" . "101") ("rm.rm_std" . "WRKSTN"))
)

Restrictions

Each restriction included in the list of restrictions can take any of the following forms:

  • (list “tableName.fieldName” value)
  • (list “tableName.fieldName” “comparison” value)
  • (list “tableName.fieldName” “comparison” “logicalOperator”)

Where:

  • tableName.fieldName: a concatenation of the table name and field name of interest.
  • comparison: how the value is to be tested. The default is “=”, which is passed in as a string. See below for a list of supported comparisons.
  • value: the value with which the comparison should be tested. The value type must be valid per the field type. For example: if the field is rm.fl_id, the value must be a string, such as 17. If the field is rm.area, the value must be a number, such as 200.0.
  • logicalOperator: specifies how multiple filters are to be logically combined. Supported values are “and” or “or”, the default is “and” if nothing is specified.

Comparison Options

  • lt
  • <
  • gt
  • >
  • lte
  • <=
  • gte
  • >=
  • like
  • isnull
  • isnotnull
  • !=
  • <>
  • in
  • notin

Example Restriction Usage

Specify a filter where “rm.rm_cat” = “SERV”

(list (list "rm.rm_cat" "SERV"))

alternatively:

(list (list "rm.rm_cat" “=” "SERV"))

Specify a filter where “rm.area” >= 75.0 AND “rm.area” < 100.0

(list (list "rm.area" ">=" 75.0) (list "rm.area" "<" 100.0))

Specify a filter where “rm.rm_type” is like “OFF” OR “rm.rm_type” = “MAIL”

((list "rm.rm_type" "like" "OFF")(list "rm.rm_type" "=" "MAIL" "or"))

Note: For the first form in which only the field name and value are specified, the operator defaults to “=”.