Select to view content in your preferred language

Auto Calculate a text box when submitting a form Survey123 Connect

607
5
Jump to solution
11-17-2023 11:05 AM
CamKenny2
New Contributor III

I am using Survey123 Connect version 3.16.110.

I have a survey that is a 2-part process.  It's for UAV and a pre-flight checklist must be completed and submitted before performing the second post-flight checklist.

I have enabled sent items so the process would be to fill the survey out before flying using the pre-flight checklist and then submitting the survey.

After the UAV mission is done, I want to go in and edit the survey and now have a new page show up to do the post-flight checklist.

My thoughts are to auto-calculate a text box to Yes when submitting the pre-flight portion.  Then when the survey is edited, I can check to see if the text box is "Yes" and therefore show the post-flight page and resubmit the survey.

I don't know what the syntax to use to auto-calculate a field "on-submit"

2 Solutions

Accepted Solutions
abureaux
MVP Regular Contributor

First, just in case this is a separate question in disguise, I'll answer this question: "...whilst still retaining the pre-flight values". This is easily achievable using the body::esri:visible column. It functions almost identically to the relevant column, except it doesn't delete data that is hidden.


Second, to answer your original question, try this:

abureaux_5-1700260397669.png

Now, when you open something via the Inbox, it will default to "Post-Flight". This may work for you, but be aware that there is a greater chance of people messing up the process and getting frustrated as there is no way for them to go back.


Thirdly, I will suggest this method. It's similar to what you were originally looking for, and has the added advantage of allowing for some user error:

abureaux_3-1700259679695.png

The user is presented with the Pre-Flight checklist upon opening the form:
abureaux_1-1700259473139.png

And selecting Post-Flight does nothing:

abureaux_2-1700259491636.png

After they fill in whatever field(s) you make your "indicator" field on the Pre-Flight side, they will be able to select Post-Flight:

abureaux_4-1700259741255.png

***Personally, I would toss the select_one question on page 1 (along with some basic universal project information), and then the checklists on page 2.

View solution in original post

abureaux
MVP Regular Contributor

My apologies for the confusion! There are two to choose from:

  1. The first using  pulldata("@property","mode") in an attempt to automate the process. This works, but I feel may potentially cause issues for end users since it assumes they will never make a mistake and need to go back.
  2. The second solution uses a select_one, and was intended to give you the same functionality you were looking for, but also allow end users to correct any mistakes they may potentially make.

The other think I mentioned was about the body::esri:visible column, and was just an information piece since you mentioned wanting to hide data without loosing it.

View solution in original post

5 Replies
abureaux
MVP Regular Contributor

There is no "on submit" function. You may be able to go off of the survey state, but I don't think that is reliable.

Why not just give them a select_one question: Pre-Flight or Post-Flight? Simple.

E.g.,

abureaux_0-1700251518910.png

 

0 Kudos
CamKenny2
New Contributor III

That may work, however, ideally, they should complete the pre-flight checklist and submit.  The post-flight checklist page is not visible.

Once submitted, the user then would edit the survey and based on a checkbox that was selected or calculated in the pre-flight would then allow the post-flight checklist page to be displayed whilst still retaining the pre-flight values.

0 Kudos
abureaux
MVP Regular Contributor

First, just in case this is a separate question in disguise, I'll answer this question: "...whilst still retaining the pre-flight values". This is easily achievable using the body::esri:visible column. It functions almost identically to the relevant column, except it doesn't delete data that is hidden.


Second, to answer your original question, try this:

abureaux_5-1700260397669.png

Now, when you open something via the Inbox, it will default to "Post-Flight". This may work for you, but be aware that there is a greater chance of people messing up the process and getting frustrated as there is no way for them to go back.


Thirdly, I will suggest this method. It's similar to what you were originally looking for, and has the added advantage of allowing for some user error:

abureaux_3-1700259679695.png

The user is presented with the Pre-Flight checklist upon opening the form:
abureaux_1-1700259473139.png

And selecting Post-Flight does nothing:

abureaux_2-1700259491636.png

After they fill in whatever field(s) you make your "indicator" field on the Pre-Flight side, they will be able to select Post-Flight:

abureaux_4-1700259741255.png

***Personally, I would toss the select_one question on page 1 (along with some basic universal project information), and then the checklists on page 2.

CamKenny2
New Contributor III

Thanks for the solution.  However, I am a bit confused.  Do I incorporate all your suggestions into the form or is there multiple options to choose from.

Looking for the easiest solution that will answer my original question as the second post by me was meant as a follow-up to my first post.

0 Kudos
abureaux
MVP Regular Contributor

My apologies for the confusion! There are two to choose from:

  1. The first using  pulldata("@property","mode") in an attempt to automate the process. This works, but I feel may potentially cause issues for end users since it assumes they will never make a mistake and need to go back.
  2. The second solution uses a select_one, and was intended to give you the same functionality you were looking for, but also allow end users to correct any mistakes they may potentially make.

The other think I mentioned was about the body::esri:visible column, and was just an information piece since you mentioned wanting to hide data without loosing it.