Changing a text answer to a numeric answer in a Survey123 Connect survey

3364
8
08-26-2019 02:59 PM
by Anonymous User
Not applicable

I created and published a Survey in Connect and then tried to create a Dashboard from the data I collected. I set a facility rating using the select_one answer and then set the appearance as a Likert for ease of use for the mobile user. Unfortunately I was unaware that this would produce a text answer instead of a numeric value and now I have 30+ records stored this way. 

1. Is there a way, post publishing, to alter this text string to a numeric value?

2. If not, I can make a copy of the survey in the Connect program, but is there a way to import the data from the original survey into the new/copy so I don't lose data or have to reproduce it?

I have photos included in the survey and I am not sure how to go about making a change like this. I know that once a survey has been published, changes to the survey can be a hassle. 

Any detailed help would be very helpful

Thanks,

0 Kudos
8 Replies
DeonLengton
Esri Contributor

Hi Doug

You can create a new numeric field for your feature layer then use the Calculate method to populate it with the integer value of your string variable...

0 Kudos
by Anonymous User
Not applicable

is this something to be done in Pro? I saw a thread about doing something like this, but have never done something like this before.

0 Kudos
DeonLengton
Esri Contributor

Hi Doug

You can add a field to a Feature Layer in ArcGIS Online.

Go to the Feature Layer - then go to the Data Tab... Then go to Fields...

You can then add a field of integer type and you can do the calculate field in a webmap.

by Anonymous User
Not applicable

OK, I did this and it worked perfectly. My next question: is there a way to make the new surveys auto calculate into the new field? I added a new survey and the new field is blank for this particular survey. My end goal is to create a dashboard for this survey, but cannot without the numeric values and having to manually perform the calculation from time to time would not be desirable.

0 Kudos
DeonLengton
Esri Contributor

Hi Doug

Yes you can now add this new field as a hidden field in your survey and use the calculate functionality to do the formula... Just make sure you set the bind::esri:fieldType to esriFieldTypeInteger to match the type of the question you added...

0 Kudos
by Anonymous User
Not applicable

Ok, I understand why i need to do this, but I am struggling to get this to work. Sorry, I am very green at making surveys and any extra details are helpful.

I have tried to enter the calculation here, but must be imputing it wrong. Not sure what or where to insert the formula as I cannot get it to work

Is this where it put the bind code?

Sorry again, really new to all of this

Thanks

0 Kudos
jzibbell_boise
New Contributor III

It works to open your survey in Connect and add a hidden field that calculates an integer from the string, but once you return to the survey in a browser the ranking question is messed up completely. The slick looking stars are gone and replaced by errored out images. So this isn't a good solution. If I try to use the web builder calculate function it doesn't provide my string question as a possible input. Help!

0 Kudos
by Anonymous User
Not applicable

If you are wanting to keep the question within your survey, then you might want to try the following, but please be very careful with this method. If there are values within the text field that cannot be converted into a number through field calculator, then plan on creating some "select by attribute" and then "calculate field" based on what the values they should be converted to.

  1. Within the ArcGIS Online GUI - Add a new numeric field named "Newfield1".
  2. Open ArcGIS Pro and add this Hosted Feature Service into a new map.
  3. Depending on the values found within the text field 
    1. If you can complete a "calculate field" operation, because the values are all numbers, then proceed.
    2. If you cannot complete a "calculate field" operation, because of non-numeric values, then
      1. Complete a "select by attribute" to find the values that cannot be directly calculated
      2. Complete a "calculate field" and "adjust the value being applied" for these non-numeric answers.
  4. Make sure that you have the name of the field and alias pasted into a text editor; this is VERY important
    1. The idea is that you will use the name of the field and it's alias in the next few steps.
  5. Here's the scary moment in the process: AFTER doing a complete QA/QC on the new field column, "delete" the text field.
  6. Create a new numeric field and name it by "Copying and pasting" the name and alias of the fields into the appropriate tool variables, while setting it to the appropriate type of number field; short. long, double.
  7. Complete a calculate field of the "NewField1" into this new field representing the old text field that has been updated into a numeric field.
  8. Close ArcGIS Pro
  9. Open up Survey123 Connect
  10. Find the question that you just updated the field to numeric and scroll over to the far right until you find the "bind::esri:fieldType" and change this into the appropriate type of numeric field.
  11. Attempt to republish the survey and it should republish without any issues.

This is another way to get the field into your survey and to replace the question at the same time. If for some reason you need to just "archive/retain" the question, then you can just add a new field within Survey123 connect, turn the "Type" from "text" to "hidden", and then add the new question to accept the new answers. However, you would have to calculate the answers from the numeric field into this new field as stated above.

Cheers,

Mike

0 Kudos