Select to view content in your preferred language

Automate Work Order Numbers

487
2
06-18-2024 05:21 AM
ThomasGoodridge
Regular Contributor

I'm trying to auto generate work order numbers. The work order id should be the current year dash submission number padded with zeros. So the submissions should look like 2024-0001. The closest I got was concat(format-date(now(), '%Y'),'-',count(${location})), which doesn't actually count survey submissions.

0 Kudos
2 Replies
abureaux
MVP Frequent Contributor

There is a blog post that covers this: Creating 'Ticket Numbers' in Survey123 for ArcGIS

you probably are looking for ObjectID, which you don't get until after you submit. Have a look at the blog.

0 Kudos
ThomasGoodridge
Regular Contributor

I figured it out! You have to create a new survey based on the original one, delete everything that aren't the work order number (bind::esri:fieldType esriFieldTypeString) and objectid fields,(bind::esri:fieldType null) , and input this calculation into work order

if(string-length(${objectid})=1,concat(format-date(now(), '%Y'),"-000",${objectid}),if(string-length(${objectid})=2,concat(format-date(now(), '%Y'),"-00",${objectid}),if(string-length(${objectid})=3,concat(format-date(now(), '%Y'),"-0",${objectid}),${objectid})))

0 Kudos