trying to SELCET DISTINCT with layer.queryFeatures(query);

196
3
Jump to solution
01-02-2022 06:21 AM
eyalj
by
New Contributor II

Hi,

I'm trying to do SELECT DISTINCT or do something equivalent with layer.queryFeatures(query);

what should the values of query should be?

Tags (3)
0 Kudos
2 Solutions

Accepted Solutions
Kishore
Occasional Contributor

@eyalj - you can define the return distinct in the query object.

query = new Query();
query.where = "condition";
query.returnDistinctValues = true);
layer.queryFeatures(query);

 Please refer to the API returnDistinctValues 

Regards,
Kishore

View solution in original post

Kishore
Occasional Contributor

@eyalj  - we have known limitations for this:

  • For service-based queries, this parameter applies only if the supportsAdvancedQueries capability of the layer is true.
  • Make sure to set returnGeometry to false when returnDistinctValues is true. Otherwise, reliable results will not be returned.

Hope you are comply with these limitations.

Regards,
Kishore

View solution in original post

0 Kudos
3 Replies
Kishore
Occasional Contributor

@eyalj - you can define the return distinct in the query object.

query = new Query();
query.where = "condition";
query.returnDistinctValues = true);
layer.queryFeatures(query);

 Please refer to the API returnDistinctValues 

Regards,
Kishore
eyalj
by
New Contributor II

When i change returnDistinctValues to true it says that suddenly i dont have any values,

eyalj_0-1641196170471.png

 

0 Kudos
Kishore
Occasional Contributor

@eyalj  - we have known limitations for this:

  • For service-based queries, this parameter applies only if the supportsAdvancedQueries capability of the layer is true.
  • Make sure to set returnGeometry to false when returnDistinctValues is true. Otherwise, reliable results will not be returned.

Hope you are comply with these limitations.

Regards,
Kishore
0 Kudos