Are there corresponding QML types or C++ classes that can be used to generate attribute values that match their field types?

971
3
Jump to solution
11-28-2016 04:27 PM
JonathonGrivas
New Contributor III

Feature attributes have specific data types which the QT SDK v100.0  enumerates here: https://developers.arcgis.com/qt/latest/qml/api-reference/enums-fieldtype.html

How would you recommend verifying that a user-inputted string will be supported in the feature table? If a datum is formatted incorrectly, the feature table rejects my updates instantly without sending a request. To me this indicates there are definitions for these field types somewhere in the library. How do I access this so I can make sure to validate/convert user input correctly? 

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

The Field has a FieldType enumeration, which are things like Date, String, Int, etc. String should accept anything that is a QString, Date should accept anything that is a QDate, and so on. Eventually, we will have a fully functional Popup that will help streamline these editing workflows. We have the building pieces in all of the Popup* classes, but we do not yet have an associated view to go with it.

View solution in original post

0 Kudos
3 Replies
LucasDanzinger
Esri Frequent Contributor

The feature table has a list of fields, which contains names and field types. You could validate against that to make sure you are using the correct data type - FeatureTable Class | ArcGISQtCpp 100.0 

Also, if your services make use of FeatureTemplates or FeatureTypes, you could use the createFeature functions that create a new feature based on the feature type or template.

0 Kudos
JonathonGrivas
New Contributor III

I don't see how to validate an attribute value from the fields in the feature table class.  Say for example I want to allow users to input text to change an attribute value for an "esriFieldTypeDate" field, when I input "test" in that field, it fails to update saying the string is an invalid format.  Are correct formats for constructing "esriFieldTypeDate" from a string listed somewhere? 

0 Kudos
LucasDanzinger
Esri Frequent Contributor

The Field has a FieldType enumeration, which are things like Date, String, Int, etc. String should accept anything that is a QString, Date should accept anything that is a QDate, and so on. Eventually, we will have a fully functional Popup that will help streamline these editing workflows. We have the building pieces in all of the Popup* classes, but we do not yet have an associated view to go with it.

0 Kudos