Get Records Functions

AfmWebServicesGetRecordsForView and AfmWebServicesGetRecords

Syntax

(AfmWebServicesGetRecordsForView strAssetType strViewName strDataSourceId restriction)

(AfmWebServicesGetRecords strAssetType restriction fieldList sortFieldList bAscending dMaxRecords)

Comments

These functions query the current project for multiple records. The AfmWebServiceGetRecords function uses the default view. The program uses dataSourceId for the specified asset type when querying for these records.

strAssetType is a table name in the database where the record will be retrieved from. (required)

strViewName is a view name for the specific asset type. (required)

strDataSourceId is a dataSourceId in the specified view name. (required)

restriction species the restriction to be applied when querying for this record. (required for AfmWebServicesGetRecords , optional for AfmWebServicesGetRecordsForView ) Set to nil if no restrictions in addition to the data source specified restrictions are to be applied,

fieldList is a list of fields to retrieve for this record. (optional. If set as nil, only the primary key values are returned in the record.)

sortFieldList is an optional list of fields that specifies the sort order. (optional. If set as nil, no sorting will be applied.)

bAscending specifies whether to sort per the sortFieldList ascending or descending. (optional. If set as nil, the default is to sort ascending.)

dMaxRecords specifies the maximum number of records to retrieve. (optional. If set to nil, all records satisfying the specified restriction will be retrieved.)

Example

The following example returns all records for a particular floor, with the list of fields to return explicitly specified.

(AfmWebServicesGetRecords
"rm"
(list (cons "rm.bl_id" "HQ") (cons "rm.fl_id" "17"))
(list "rm.rm_id" "rm.rm_type" "rm.prorate" "rm.rm_cat")
sortFields ; List of sortfields (If none, set to nil)
'T ; Sort Ascending
nil ; Number of records to return (Set to nil for all records)
)


Here is an example of how a more complex restriction using OR logic should be constructed.

(setq restriction
    (list (list "rm.bl_id" "HQ") (list "rm.fl_id" "17")
     '("<AND") (list "rm.rm_type" "like" "OFF")(list "rm.rm_type" "=" "LOBBY" "or") (list "rm.rm_type" "=" "MECH" "or")      '("<AND") ) )