AttachmentQuery

AMD: require(["esri/tasks/support/AttachmentQuery"], (AttachmentQuery) => { /* code goes here */ });
ESM: import AttachmentQuery from "@arcgis/core/tasks/support/AttachmentQuery";
Class: esri/tasks/support/AttachmentQuery
Inheritance: AttachmentQuery Accessor
Since: ArcGIS API for JavaScript 4.9
Deprecated since version 4.20. Use AttachmentQuery instead.

This class defines parameters for executing queries for feature attachments from a feature layer. Once an AttachmentQuery object's properties are defined, it can then be passed into the QueryTask.executeAttachmentQuery() or FeatureLayer.queryAttachments() methods, which will return attachmentInfos grouped by the source feature objectIds.

Known Limitations

See also:

Constructors

new AttachmentQuery(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Stringmore details

The where clause to be applied to attachment queries.

more detailsAttachmentQuery
String[]more details

The file format that is supported by query attachment.

more detailsAttachmentQuery
Stringmore details

The name of the class.

more detailsAccessor
Number[]more details

An array of globalIds for the features in the layer being queried.

more detailsAttachmentQuery
String[]more details

Used to query for attachments that match the provided keywords.

more detailsAttachmentQuery
Stringmore details

Used to query for attachments that match this name.

more detailsAttachmentQuery
Numbermore details

The number of features to retrieve.

more detailsAttachmentQuery
Number[]more details

An array of objectIds of the features to be queried for attachments.

more detailsAttachmentQuery
Booleanmore details

If true, the Exchangeable image file format for the attachment will be included in attachmentInfo.

more detailsAttachmentQuery
Number[]more details

The file size of the attachment is specified in bytes.

more detailsAttachmentQuery
Numbermore details

This option fetches query results by skipping a specified number of records.

more detailsAttachmentQuery
Stringmore details

The where clause to be applied to the layer.

more detailsAttachmentQuery

Property Details

attachmentsWhere String
Since: ArcGIS API for JavaScript 4.20

The where clause to be applied to attachment queries. Only attachments that satisfy the attachmentsWhere clause will be returned.

Example:
const query = new AttachmentQuery({
  where: "1=1", // query all features in the layer
  attachmentsWhere: "keywords = 'ladybug, purple'" // attachment queries
});
attachmentTypes String[]

The file format that is supported by query attachment. For example, image/jpeg. See the ArcGIS REST API documentation for more information on supported attachment types.

Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be true.

declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

globalIds Number[]

An array of globalIds for the features in the layer being queried. The query results will return attachments only for specified global ids.

Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be true.

keywords String[]
Since: ArcGIS API for JavaScript 4.20

Used to query for attachments that match the provided keywords.

Examples:
const query = new AttachmentQuery({
  where: "1=1", // query all features in the layer
  attachmentsWhere: "keywords = 'ladybug, purple'" // attachment queries
});
const query = new AttachmentQuery({
  where: "1=1", // query all features in the layer
  attachmentsWhere: "keywords like 'buildings%'" // attachment queries
});
name String
Since: ArcGIS API for JavaScript 4.20

Used to query for attachments that match this name.

Example:
const query = new AttachmentQuery({
  where: "1=1", // query all features in the layer
  attachmentsWhere: "name = 'ladybug.png'" // attachment queries
});
num Number

The number of features to retrieve. This option should be used in conjunction with the start property. Use this to implement paging (i.e. to retrieve "pages" of results when querying). Default Value is 10.

If not provided, but an instance of AttachmentQuery has a start property, then the default value of num is maxRecordCount. The maximum value for this parameter is the value of the layer's maxRecordCount of the service, which can be found at the REST endpoint of the feature layer.

Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be true.

objectIds Number[]

An array of objectIds of the features to be queried for attachments. When the feature layer's capabilities.query.supportsAttachments property is false, it only accepts a single objectId.

returnMetadata Boolean
Since: ArcGIS API for JavaScript 4.20

If true, the Exchangeable image file format for the attachment will be included in attachmentInfo. The layer's capabilities.attachment.supportsExifInfo must be true for the attachment query to return exifInfo for the attachments.

Default Value:false
size Number[]

The file size of the attachment is specified in bytes. You can enter a file size range [1000,15000] to query for attachments. The query result will return all attachments within the specified file size range (1000 - 15000).

Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be true.

start Number

This option fetches query results by skipping a specified number of records. The query results start from the next record. The default value is 0. This parameter only applies when the feature layer's capabilities.query.supportsPagination is true. You can use this option to fetch records that are beyond maxRecordCount.

Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be true.

where String
Since: ArcGIS API for JavaScript 4.20

The where clause to be applied to the layer. Only features that satisfy the where clause and are in the list of objectIds will be returned. Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be true.

Method Overview

Name Return Type Summary Class
AttachmentQuerymore details

Creates a deep clone of AttachmentQuery object.

more detailsAttachmentQuery
*more details

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

more detailsAttachmentQuery
Objectmore details

Converts an instance of this class to its ArcGIS portal JSON representation.

more detailsAttachmentQuery

Method Details

clone(){AttachmentQuery}static

Creates a deep clone of AttachmentQuery object.

Returns:
Type Description
AttachmentQuery A new instance of a AttachmentQuery object equal to the object used to call .clone().
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
Type Description
* Returns a new instance of this class.
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns:
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.