Open xiao8579 opened 1 year ago
@xiao8579 Arcade expressions are evaluated when the data is about to be sent to ArcGIS. This guarantees that the device is connected and ensures any expression that uses a web service will work fine. Expressions are not evaluated at the time when data is collected. May want to clarify in the instructions.
Test project: Accuracy conversion
This uses an arcade expression to calculate the horizontal accuracy in feet from the value meters.
h_accuracy_m
is populated using the horizontal accuracy variable ("${horizontalAccuracy}")h_accuracy_f
is calculated using the arcade expression:
"${arcadeExpression: return $feature['h_accuracy_m'] * 3.28084}"
Results: https://quickcapture.maps.arcgis.com/home/item.html?id=8dcb2b6f7a5f4a6886504beb6332c194#data
Testing just very basic calculations like John's above works on iPhone 11.
Just an observation, the arcade expression is limited by the length of the field. For example, I have a field length of 4 to accommodate only a year. I wanted to test an arcade expression to write the year for me so I do not have to go back and enter them manually but I will have the change the field length to do so.
Calculation like in example works, pull pt in polygon, having issues with that, might be syntax error?
i started by crafting my expression in the Map Viewer:
and then removed the carriage returns and placed this in the value field for lady bug notes:
"value": "${arcadeExpression: var region = FeatureSetByName($map,'Catchments - Waterways and Drains Subcatchments', ['SUB_CATCHMENT_NAME'])\n var region = First(Intersects($feature, region))\n if (!IsEmpty(region)) {return region['SUB_CATCHMENT_NAME']} else {return null}}"
i did need to manually change the "" that were generated in Map Viewer to be '' in QuickCapture
this is the result in Map Viewer: (the notes field is populated with the name of the sub catchment polygon within which the lady bug was located. expression only placed on lady bugs.
data captured on android, pixel 6
Description
Calculate field values using an Arcade expression.
Test
How to configure?
Coming soon: use QuickCapture designer to write and test your Arcade expressions for a selected data field.
For testing purposes:
Compose and test your arcade expressions with Calculate function in Map Viewer Classic![image](https://user-images.githubusercontent.com/18433455/200648234-3da01e9b-9d89-43be-b8aa-ca169def7b0a.png)
When done with testing, copy and paste the script to the target Text field with in your project.
"${arcadeExpression: _your scripts goes here_}"
\n
- new line)Save the project.
How does it work on the mobile app?