Select to view content in your preferred language

Calculate Field Tool with JSON Data: Calculate Field works in Pro, not Velocity?

753
3
Jump to solution
09-26-2023 10:55 AM
ArmstKP
Frequent Contributor

I have sensor data coming in and multiple values come into one field.  I have been able to create a dictionary in the Arcade expression in Pro and it will calculate successfully.  In Velocity, this same Arcade expression will not work when using the calculate field tool.  Is there a different function I should be using in Velocity?

 

Expression validates and calculates in Pro:

ArmstKP_0-1695750744162.png

 

In Velocity, it will throw a Missing Parameter or Illegal JSON error:

ArmstKP_1-1695750904860.png

 

 

0 Kudos
2 Solutions

Accepted Solutions
brudo
by
Occasional Contributor

Have you supplied a suitable sample value for last_values, e.g. '{"field1":{"value":1}}'?

View solution in original post

0 Kudos
PeterNasuti
Esri Contributor

@ArmstKP Thanks for making this post, I would agree with @brudo 's first question. For a "string/text" type field in Velocity, the Arcade default sample value to be evaluated is the string "Pacific" which would not pass your expression and return your desired data type.

The sample values (your JSON in the field) must be provided on the right side for the corresponding field. If you have done this and are still encountering issues, please reach out here or log a support case. Thanks!

ArcadeSample.png

View solution in original post

0 Kudos
3 Replies
brudo
by
Occasional Contributor

Have you supplied a suitable sample value for last_values, e.g. '{"field1":{"value":1}}'?

0 Kudos
ArmstKP
Frequent Contributor

@brudo @PeterNasuti Thank you both, I didn't supply the sample from that field.  I did so and then it worked.

Thank you both!

 

0 Kudos
PeterNasuti
Esri Contributor

@ArmstKP Thanks for making this post, I would agree with @brudo 's first question. For a "string/text" type field in Velocity, the Arcade default sample value to be evaluated is the string "Pacific" which would not pass your expression and return your desired data type.

The sample values (your JSON in the field) must be provided on the right side for the corresponding field. If you have done this and are still encountering issues, please reach out here or log a support case. Thanks!

ArcadeSample.png

0 Kudos