If Then Statement and Auto Increment

07-20-2020 02:10 PM
New Contributor III


I have a particular workflow that I'm trying to determine the best approach for. 

In Survey 123 Connect, I have a 'Description/WIP' dropdown question in which the user needs to first select:

After selecting the desired 'Description/WIP', there is another field ('Container Number') which contains a defined value based on the 'Description/WIP' selection using the following fomula:

if(${Description}='AEROSOL', 'abc', if(${Description}='PAINT CAN', 'xyz',''))

What I am trying to figure out is adding a sequential value after 'xyz'.  For example, the first time the 'Container Number' field would fill 'xyz1' the first time 'AEROSOL' is selected in the 'Description/WIP' field.  The next time that they use the survey and if they happen to select 'AEROSOL' again, the 'Container Number' would then fill 'xyz2'.

I have tried creating hidden integer fields for each 'Description/WIP' and have that auto increment using an if then statement without any success up to this point.

If anyone has any suggestions or recommendations, they would be greatly appreciated.

Thanks in advance,


Tags (1)
0 Kudos
2 Replies
Esri Esteemed Contributor

Hi Craig,

Are you trying to increment within your form (presumably, in a repeat sections) or between different submissions?  If within a repeat section, this can be possible by having a hidden field serve as a counting field (see Field Calculated by the Repeat Number as a guide).  If you are trying to account across submissions, this is more difficult - we talk about this in terms of 'ticket numbers' in https://community.esri.com/groups/survey123/blog/2017/11/25/creating-ticket-numbers-in-survey123-for... 

0 Kudos
New Contributor III

Hi James,

Thanks for the reply.  In this workflow I would be accounting across submissions.  I will take a look at the link that you supplied to determine our best plan of action.


0 Kudos