Formatting number field for GP Service

179
2
Jump to solution
06-12-2019 10:56 AM
AllenScully
Occasional Contributor II

We have a GP service where the last step is to add a field (DOUBLE, holds 2 decimal places) - and does a field calculation.  It's going from feet to miles - we only want to display 2 decimal places - so .34 miles instead of .34125823672... for example.

All works correctly running the tool in ArcMap - the output dataset is an in_memory feature layer, with the correct properties in the calculated miles field.  

Using the tool through a GP Widget in WAB (Portal, 10.6) - the field in question displays all of the decimal places - not respecting what was set in the script.  

Any way to enforce this in the Widget config (nothing obvious I could see) or tool config in arcmap?

Thanks - 

Allen

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Allen,

Can you update the Field Calculation and use Python to round the calculation (i.e. round(val, 2)) to two decimal values?

View solution in original post

2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Allen,

Can you update the Field Calculation and use Python to round the calculation (i.e. round(val, 2)) to two decimal values?

AllenScully
Occasional Contributor II

Excellent - many thanks Jake, that does the trick. 

Still curious why it displayed correctly in ArcMap running the tool, but differently when run as a GP Service, since the properties of the field is explicitly set to be 2 decimal places.

Custom GP services are fickle things.

Allen

0 Kudos