Float data types not accepted in Workflow Add Feature activity
I have a feature class that had a Diameter field with the Esri float data type (equivalent to SQL numeric(4,1) data type).
I was having trouble getting the Add Feature activity to succeed, seeing this error:
I attempted several ways to ensure a float value, but kept getting rejected.
To continue testing and troubleshooting, I went through the painful process of changing an Esri data type from float to double (equivalent to the SQL numeric(7,1) data type) and then my workflow is successful and adds the feature to my feature class.
Example and snippet of number form element
For now, this adds a big step to our enterprise geodatabase conversion plan; no more float data types, convert them all to double. Has anyone ran into similar behavior.
Thanks!
-
Running into this again but with tables with many more Esri float data types. Any ideas or suggestions?
0 -
Note: I don't get the error if I use a Number Slider form element, BUT the value does not make it into the database either - it silently fails.
The data type is set to
- ArcGIS Pro: float, precision = 4, scale = 1
Translates to SQL data type numeric(4,1)
Snippet of workflow showing form element configuration
Snippet of Create Feature activity, adapted to handle possible null values
0 -
I'm guessing that you're non-number-slider inputs are textboxes, and that you are simply trying to pass the textboxes' values to a Create Feature activity? If you are just passing the value of the textbox, then its data type is going to be a string and that will cause trouble for you. Try the Number() function to get a numeric data type.
As for the number sliders, I'm not sure what the issue is. I see your attributes input code with that ternary in there (which by the way, 👍) , but would want to check the evaluation of that input in the dev console and ensure that you see the numeric values that you want to see in the Temperature field. If the feature doesn't end up with a numeric field, you'll simply need to track down where your disconnect is.
If the attribute values in your upload are numeric, then you might try uploading a featureSet instead of a feature so you can define fields. In your case, I'd probably use the FeatureSet from JSON activity for this, being that you already have your attributes ready to go you just need a wrapper and your field(s). Here's a little template I use with a double in there to get you rolling:
= {
fields: [{
name: "Attr1",
type: "double"
}],
features: [
{
attributes: {
Attr1: $form1.state.numberSlider1.value == null
? null
: $form1.state.numberSlider1.value.numeric,
Attr2: $form1.state.textBox1.value
},
geometry: $form1.state.geometryPicker1.value // unnecessary, you can remove
}
]
}I'm not sure whether you'll need all fields defined in the latter case, you might try just defining the trouble children and see what happens.
0 -
Thanks again for the tips Zack Robison!
I am using the Number form element with the lower bound, step size, and precision defined as above, and the content JSON matches the designer:
Here's a snippet of the stack trace:
The output of the last Add Features activity debug before the error is holding the value I entered as a double, which I think is expected with Javascript. Do I need an activity to convert this "Javascript double" to an "Esri float"?
I'll give the FeatureSet From JSON a try!
Thank you.0 -
Tried out the Get Feature Set From JSON, finally got the syntax correct and get back to the same error:
Same error if I just stuff the value in the JSON
The enterprise geodatabase field schema snippet:
Is the Esri float data type a sort of deprecated thing? I can't find much documentation for float, but plenty for double.
And the SQL Server data type mapping here is only concerned about Esri double:
Note that these fields were created years ago and could just be out of date. So, maybe the answer is going to be that we need to overhaul the feature class, which would be unfortunate.
0 -
I'm not sure what the issue is, but Esri has not deprecated the float data type in their desktop products. The mapping you linked is between Insights and, if I'm not mistaken, the ArcGIS Java or .NET libraries (I haven't dealt with Insights enough to know which), if you're curious here's the documentation for Pro.
I'd be surprised if you needed to change the db field, though not shocked. To continue debugging I'd try making edits through the ArcGIS Server REST endpoint directly and see what the Server Manager logs have to say about it. Have you checked those logs yet, by the way? If this is a data type error they will say so.
0 -
Whoops, I'm also not familiar with Insights. Good call, thanks.
I went ahead and recreated my table with all the float changed to double, put that table in my relationship class, published to a web map, and my mobile app can bind these values now. So, it is a workaround, but might cause some headaches down the road with backwards compatibility from the mobile app tables to other databases we host.
I have not found anything related to these errors in the Server logs.
Ran Add Features at the REST endpoint and it is successful.
0 -
I almost mentioned that there could've been a service issue too, I've seen this sort of behavior before disappear by simply republishing a service which had some buggy misconfiguration. If you're not getting error logs for failed attempts to add features then the service may very well have been bugged up, unless your ArcGIS Server log settings are extremely lightweight.
I remain skeptical that the issue is with the float data type itself, but if you have something that works then there's no pressing need to dig into it further is there. If you wanted to investigate further you might try publishing with both types of field and see what happens when you try to add.
In any case, good job on the workaround.
0 -
I have run into that enough too and I did try that: delete the services (overwriting is not enough to ensure the misconfiguration goes away and I am starting to work with the vector tile layers which need more "devops" in place to properly overwrite) and publish anew, but saw no change.
Thanks Zack!
0 -
Well that is really something. Double it is I guess!
0 -
Hi Zack and Alex,
Just want to mention that we are running into the exact same error; I've tried every type of numeric data, float- and integer Javascript parse functions, even a lot of ways to write the number as a string, but I cannot get the Number display form element to write data to a Float field in a feature service.
We will change the datamodel to make the fields Double, hope that works. But I would love to see a solution for this issue. Adding data through ArcGIS Online works perfectly fine, so it seems to be an issue with the Modules.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
11 kommentarer