Select to view content in your preferred language

Is there a setDefinitionExpression method for the QML API?

4262
4
Jump to solution
03-19-2015 10:30 AM
IsaiahAguilera
Frequent Contributor

Is there a setDefinitionExpression method for the QML API for feature layers?

I only see the method under the C++ API ref.  Is there no way to do this in QML?

0 Kudos
1 Solution

Accepted Solutions
MichaelTims
Occasional Contributor

I'd recommend using the GeodatabaseFeatureServiceTable with the FeatureLayer.  This is the direction moving forward for feature layer support in the Runtime.  The ArcGISFeatureLayer is still provided for feature collections (initializing a feature layer from a feature set) because the Runtime API doesn't yet support that feature with the FeatureLayer using a FeatureTable.

I reproduced the problem and noticed that somewhere in the instantiation process of the declared GeodatabaseFeatureServiceTable, it is losing the definitionExpression.  I'd recommend logging this as a bug through support.  In the meantime as a workaround, you could wait to assign the definitionExpression when the feature table is initialized.

Here's an example:

  GeodatabaseFeatureServiceTable {

    id: featureServiceTable
    url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/0"
    //definitionExpression: "eventtype = 1"

    onFeatureTableStatusChanged: {
      if (featureTableStatus === Enums.FeatureTableStatusInitialized) {
        definitionExpression = "eventtype = 1"
      }
    }
  }

View solution in original post

0 Kudos
4 Replies
StevenGraf1
Frequent Contributor

Is this what you are looking for?  ArcGIS Runtime SDK for Qt (QML API): ArcGISFeatureLayer

Steven

0 Kudos
MichaelTims
Occasional Contributor

Isaiah, yes there is a definitionExpression on the GeodatabaseFeatureServiceTable:  https://developers.arcgis.com/qt/qml/api-reference/class_geodatabase_feature_service_table.html#aa27...

ArcGIS Runtime SDK for Qt (QML API): GeodatabaseFeatureServiceTable

We recommend using the GeodatabaseFeatureServiceTable with a FeatureLayer in the QML API, unless you are working with feature collections in which the ArcGISFeatureLayer is the way to go.

0 Kudos
IsaiahAguilera
Frequent Contributor

Thank for the quick responses.  I am coming from the JS API and was trying to use FeatureLayer with GeodatabaseFeatureServiceTable but I couldn't even get the points to draw with this setup. I am thinking it is because it does not honor the definitionExpresion I am inputting and without it there are a lot of points to try and draw. 

I switched to the ArcGISFeatureLayer and all of the points draw but still no honoring of the definitionExpression. So I guess I have two questions.

Is there a specific method to execute in order to set the definition expression on a GeodatabaseFeatureServiceTable or ArcGISFeatureLayer? My current method is not working.

Current Method:

GeodatabaseFeatureServiceTable {
         id: incidentServiceTable
         url: "http://servername/arcgis/rest/services/servicename/MapServer/0"
         definitionExpression: "Day = 0"
     }

What is the difference between FeatureLayer and ArcGISFeatureLayer? Still not sure which one I should use with my point layer mapservice.  In the JS API there was FeatureLayer but it seemed setup more like the QML ArcGISFeatureLayer. Plus it seems like ArcGISFeatureLayer is the only one that allows my points to draw on the map.

Any more help would be greatly appreciated!

Thanks,

Isaiah

0 Kudos
MichaelTims
Occasional Contributor

I'd recommend using the GeodatabaseFeatureServiceTable with the FeatureLayer.  This is the direction moving forward for feature layer support in the Runtime.  The ArcGISFeatureLayer is still provided for feature collections (initializing a feature layer from a feature set) because the Runtime API doesn't yet support that feature with the FeatureLayer using a FeatureTable.

I reproduced the problem and noticed that somewhere in the instantiation process of the declared GeodatabaseFeatureServiceTable, it is losing the definitionExpression.  I'd recommend logging this as a bug through support.  In the meantime as a workaround, you could wait to assign the definitionExpression when the feature table is initialized.

Here's an example:

  GeodatabaseFeatureServiceTable {

    id: featureServiceTable
    url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/0"
    //definitionExpression: "eventtype = 1"

    onFeatureTableStatusChanged: {
      if (featureTableStatus === Enums.FeatureTableStatusInitialized) {
        definitionExpression = "eventtype = 1"
      }
    }
  }
0 Kudos