require(["esri/rest/support/AttachmentQuery"], (AttachmentQuery) => { /* code goes here */ });
import AttachmentQuery from "@arcgis/core/rest/support/AttachmentQuery.js";
esri/rest/support/AttachmentQuery
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 query.executeAttachmentQuery() or FeatureLayer.queryAttachments() methods, which will return attachmentInfos grouped by the source feature objectIds.
Known Limitations
- All properties except objectIds require an ArcGIS Server service 10.5 or greater, and
feature layer's capabilities.query.supportsAttachments to be
true
. - When the feature layer's capabilities.query.supportsAttachments
property is
false
, objectIds property only accepts a singleobjectId
.
- See also
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The where clause to be applied to attachment queries. | AttachmentQuery | ||
The file format that is supported by query attachment. | AttachmentQuery | ||
Indicates if the service should cache the attachment query results. | AttachmentQuery | ||
The name of the class. | Accessor | ||
An array of globalIds for the features in the layer being queried. | AttachmentQuery | ||
Used to query for attachments that match the provided | AttachmentQuery | ||
Used to query for attachments that match this | AttachmentQuery | ||
The number of features to retrieve. | AttachmentQuery | ||
An array of objectIds of the features to be queried for attachments. | AttachmentQuery | ||
If | AttachmentQuery | ||
The file size of the attachment is specified in bytes. | AttachmentQuery | ||
This option fetches query results by skipping a specified number of records. | AttachmentQuery | ||
The | AttachmentQuery |
Property Details
-
attachmentsWhere
attachmentsWhere String
-
The where clause to be applied to attachment queries. Only attachments that satisfy the
attachmentsWhere
clause will be returned.Exampleconst query = new AttachmentQuery({ where: "1=1", // query all features in the layer attachmentsWhere: "keywords = 'ladybug, purple'" // attachment queries });
-
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
.
-
cacheHint
cacheHint Boolean
Since: ArcGIS Maps SDK for JavaScript 4.24AttachmentQuery since 4.20, cacheHint added at 4.24. -
Indicates if the service should cache the attachment query results. It only applies if the layer's capabilities.attachment.supportsCacheHint is set to
true
. Use only for queries that have the same parameters every time the app is used. Some examples of cacheable queries:- Queries based on preset input, for example, a drop-down list of US states.
- Queries based on preset extents, for example bookmarks, in web maps.
- Default Value:undefined
-
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
.
-
Used to query for attachments that match the provided
keywords
.Examplesconst 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
name String
-
Used to query for attachments that match this
name
.Exampleconst query = new AttachmentQuery({ where: "1=1", // query all features in the layer attachmentsWhere: "name = 'ladybug.png'" // attachment queries });
-
num
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 ofnum
ismaxRecordCount
. The maximum value for this parameter is the value of the layer'smaxRecordCount
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
.
-
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 singleobjectId
.
-
returnMetadata
returnMetadata Boolean
-
If
true
, the Exchangeable image file format for the attachment will be included in attachmentInfo. The layer's capabilities.attachment.supportsExifInfo must betrue
for the attachment query to returnexifInfo
for the attachments.- Default Value:false
-
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
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 istrue
. You can use this option to fetch records that are beyondmaxRecordCount
.Requires an ArcGIS Server service 10.5 or greater and feature layer's capabilities.query.supportsAttachments to be
true
.
-
where
where String
-
The
where
clause to be applied to the layer. Only features that satisfy thewhere
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 betrue
.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Creates a deep clone of AttachmentQuery object. | AttachmentQuery | ||
* | Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. | AttachmentQuery | |
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor | ||
Converts an instance of this class to its ArcGIS portal JSON representation. | AttachmentQuery |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. -
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
clone
clone(){AttachmentQuery}
-
Creates a deep clone of AttachmentQuery object.
ReturnsType Description AttachmentQuery A new instance of a AttachmentQuery object equal to the object used to call .clone()
.
-
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.Parameterjson ObjectA 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.
ReturnsType Description * Returns a new instance of this class.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
toJSON
toJSON(){Object}
-
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.