Survey saving answers to non-relevant fields

668
9
10-14-2021 01:30 PM
RainaMonaghan1
New Contributor

Hello,

In my XLS form, I have a select_one question (titled "Type") that triggers a few relevant fields depending on the selection. In the preview, if I make a choice for "Type" and fill out a few relevant fields, and then change my selection for "Type", my answers to the previously relevant fields will be wiped out. This is not the case after publishing, however--if I change my answer to "Type", it will still retain all the answers from the now non-relevant fields. Is there any way to change this? 

Please let me know if I can explain myself better, thanks!

0 Kudos
9 Replies
DeonLengton
Esri Contributor

Hi Raina

I made a survey similar to yours:

DeonLengton_1-1634277781633.png

When I publish and run this on the Survey123 App it works as expected. If I choose 'Yes' in the select_one then my "yes" questions are relevant. If I then fill in values for the "yes" questions and later change the select_one to "no" then those "yes" questions are cleared out as expected.

I know they are cleared out by using a note field to view their contents:

Capturing "yes" values:

DeonLengton_2-1634277891620.png

Changing  my option to "No":

DeonLengton_3-1634277929027.png

Note field is empty.

Also the data sent back to the feature layer seems to be as expected:

DeonLengton_4-1634278088827.png

Record 1 was done by just choosing the yes option and capturing the yes questions.

Record 2 was done by choosing yes, filling the yes fields and then changing the answer to no and filling the no fields. As expected the relevant=false check nullified the data entered

0 Kudos
RainaMonaghan1
New Contributor

Hi, Deon.

Thank you so much for your response. Unfortunately, this is not the case with my survey. It is consistently saving answers from non-relevant fields. 

So far, the only thing that has worked is using an if statement in the calculation field, where I'm stating that if selection is a certain type, true(), otherwise null. While this works, it is populating text fields with the word "true". Would you be able to help me with these statements, so that "true" does not appear in any text fields? Any guidance would be very helpful.

Thanks so much,

Raina

0 Kudos
DeonLengton
Esri Contributor

Could you perhaps share your survey?

0 Kudos
RainaMonaghan1
New Contributor

No problem! Would a screenshot or the xls file be more helpful?

0 Kudos
RainaMonaghan1
New Contributor

Here is the file. I think it might be a little too long to share a screenshot of. 

0 Kudos
DeonLengton
Esri Contributor

Hi Raina

I tried to simulate what you experience. I captured one Event type record and one Garden type record  but it looks like all the irrelevant fields are still null. Can you perhaps give me a specific test case where you see incorrect values in irrelevant fields?

DeonLengton_0-1634714537572.png

 

0 Kudos
RainaMonaghan1
New Contributor

Thank you so much for your patience with helping me out.

Here is a submission I created:

RainaMonaghan1_0-1634741989094.png

This reflects a private garden that has annual events ("Yes") and is a nursery.

This survey is based off of a hosted layer, so I republished this survey without the connection hoping for a different outcome but the issue is still there. 

0 Kudos
DeonLengton
Esri Contributor

Thanks Raina, this is very curious indeed.

Can you check on Survey123 Connect to see what the data values looks like when you put your values in there?

DeonLengton_0-1634797549483.png

{
  "Survey_esri": {
    "street_adddress": "123 Rubida St",
    "City": "Tshwane",
    "State": "Gauteng",
    "X": 28.30197995915171,
    "Y": -25.757690004891572,
    "Pollinator_Assets_point": {
      "type": "point",
      "x": 28.30197995915171,
      "y": -25.757690004891572,
      "z": null,
      "spatialReference": {
        "wkid": 4326
      }
    },
    "XValue": "28.30197995915171",
    "YValue": "-25.757690004891572",
    "ValidX": "0",
    "ValidY": "0",
    "Allowed": "0",
    "Submitter_name": "sdas",
    "Submitter_email": "adas@gmail.com",
    "Submitter_org": "asdsad",
    "asset_type": "Garden",
    "garden_type": "Private",
    "garden_reg": "Yes",
    "garden_comm_science": "Yes",
    "garden_reg_org": "1231",
    "Comm_science_desc": "123",
    "asset_name": "123",
    "asset_org": null,
    "Website": null,
    "asset_desc": null,
    "address": {
      "address": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184, ZAF",
      "location": {
        "y": -25.757690004891572,
        "x": 28.30197995915171
      },
      "attributes": {
        "AddBldg": "",
        "AddNum": "123",
        "AddNumFrom": "",
        "AddNumTo": "",
        "AddRange": "",
        "Addr_type": "PointAddress",
        "BldgName": "",
        "BldgType": "",
        "Block": "",
        "City": "Tshwane",
        "Country": "ZAF",
        "DisplayX": 28.30197995915171,
        "DisplayY": -25.757690004891572,
        "Distance": 1983.557473219845,
        "District": "Murrayfield",
        "ExInfo": "",
        "LangCode": "ENG",
        "LevelName": "",
        "LevelType": "",
        "Loc_name": "World",
        "LongLabel": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184, ZAF",
        "Match_addr": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184",
        "MetroArea": "",
        "Nbrhd": "",
        "Phone": "",
        "PlaceName": "",
        "Place_addr": "123 Rubida St, Tshwane, Gauteng, 0184",
        "Postal": "0184",
        "PostalExt": "",
        "Rank": 20,
        "Region": "Gauteng",
        "RegionAbbr": "",
        "Score": 100,
        "Sector": "",
        "ShortLabel": "123 Rubida St",
        "Side": "R",
        "StAddr": "123 Rubida St",
        "StDir": "",
        "StName": "Rubida",
        "StPreDir": "",
        "StPreType": "",
        "StType": "St",
        "Status": "M",
        "SubAddr": "",
        "Subregion": "Tshwane",
        "Territory": "",
        "Type": "",
        "URL": "",
        "UnitName": "",
        "UnitType": "",
        "X": 28.30183327584617,
        "Xmax": 28.30297995915171,
        "Xmin": 28.300979959151707,
        "Y": -25.757474757618077,
        "Ymax": -25.75669000489157,
        "Ymin": -25.758690004891573,
        "Zone": "Pretoria"
      },
      "score": 100,
      "extent": {
        "xmax": 28.30297995915171,
        "xmin": 28.300979959151707,
        "ymax": -25.75669000489157,
        "ymin": -25.758690004891573
      },
      "spatialReference": {
        "latestWkid": 4326,
        "wkid": 4326
      },
      "searchText": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184, ZAF",
      "candidates": [
        {
          "address": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184, ZAF",
          "location": {
            "y": -25.757690004891572,
            "x": 28.30197995915171
          },
          "attributes": {
            "AddBldg": "",
            "AddNum": "123",
            "AddNumFrom": "",
            "AddNumTo": "",
            "AddRange": "",
            "Addr_type": "PointAddress",
            "BldgName": "",
            "BldgType": "",
            "Block": "",
            "City": "Tshwane",
            "Country": "ZAF",
            "DisplayX": 28.30197995915171,
            "DisplayY": -25.757690004891572,
            "Distance": 1983.557473219845,
            "District": "Murrayfield",
            "ExInfo": "",
            "LangCode": "ENG",
            "LevelName": "",
            "LevelType": "",
            "Loc_name": "World",
            "LongLabel": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184, ZAF",
            "Match_addr": "123 Rubida St, Murrayfield, Tshwane, Gauteng, 0184",
            "MetroArea": "",
            "Nbrhd": "",
            "Phone": "",
            "PlaceName": "",
            "Place_addr": "123 Rubida St, Tshwane, Gauteng, 0184",
            "Postal": "0184",
            "PostalExt": "",
            "Rank": 20,
            "Region": "Gauteng",
            "RegionAbbr": "",
            "Score": 100,
            "Sector": "",
            "ShortLabel": "123 Rubida St",
            "Side": "R",
            "StAddr": "123 Rubida St",
            "StDir": "",
            "StName": "Rubida",
            "StPreDir": "",
            "StPreType": "",
            "StType": "St",
            "Status": "M",
            "SubAddr": "",
            "Subregion": "Tshwane",
            "Territory": "",
            "Type": "",
            "URL": "",
            "UnitName": "",
            "UnitType": "",
            "X": 28.30183327584617,
            "Xmax": 28.30297995915171,
            "Xmin": 28.300979959151707,
            "Y": -25.757474757618077,
            "Ymax": -25.75669000489157,
            "Ymin": -25.758690004891573,
            "Zone": "Pretoria"
          },
          "score": 100,
          "extent": {
            "xmax": 28.30297995915171,
            "xmin": 28.300979959151707,
            "ymax": -25.75669000489157,
            "ymin": -25.758690004891573
          },
          "spatialReference": {
            "latestWkid": 4326,
            "wkid": 4326
          }
        }
      ]
    }
  }
}
0 Kudos
RainaMonaghan1
New Contributor

The issue here is that Connect will work correctly! All the nonrelevant field answers don't show up. Well, kind of. If I answer a question from a nonrelevant field, it will show up as an empty string.

This is okay for the most part. The issue is really only with the published version.

Here is a snippet:

 

{

"Calumet_Pollinator_Assets": {

"street_adddress": null,

"City": "Gary",

"State": "Indiana",

"X": -87.33716999999996,

"Y": 41.60369000000003,

"geopoint": {

"type": "point",

"x": -87.33716999999996,

"y": 41.60369000000003,

"z": null,

"spatialReference": {

"wkid": 4326

}

},

"XValue": "-87.33716999999996",

"YValue": "41.60369000000003",

"ValidX": "1",

"ValidY": "1",

"Allowed": "2",

"Submitter_name": "First Last",

"Submitter_email": "email@email.com",

"asset_type": "Garden",

"garden_type": "Private",

"garden_reg": null,

"garden_comm_science": null,

"garden_reg_org": null,

"NPSN_type": "",

"NP_sale_date": null,

"Program_type": "",

"asset_name": "Asset",

"address": {

"address": "Gary, IN, USA",

"location": {

"y": 41.60369000000003,

"x": -87.33716999999996

},

"attributes": {

"AddBldg": "",

"AddNum": "",

"AddNumFrom": "",

"AddNumTo": "",

"AddRange": "",

"Addr_type": "Locality",

"BldgName": "",

"BldgType": "",

"Block": "",

"City": "Gary",

"Country": "USA",

"DisplayX": -87.33716999999996,

"DisplayY": 41.60369000000003,

"Distance": 0,

"District": "",

"ExInfo": "",

"LangCode": "ENG",

"LevelName": "",

"LevelType": "",

"Loc_name": "World",

"LongLabel": "Gary, IN, USA",

"Match_addr": "Gary, Indiana",

"MetroArea": "Chicagoland",

"Nbrhd": "",

"Phone": "",

"PlaceName": "Gary",

"Place_addr": "Gary, Indiana",

"Postal": "",

"PostalExt": "",

"Rank": 8.02,

"Region": "Indiana",

"RegionAbbr": "IN",

"Score": 100,

"Sector": "",

"ShortLabel": "Gary",

"Side": "",

"StAddr": "",

"StDir": "",

"StName": "",

"StPreDir": "",

"StPreType": "",

"StType": "",

"Status": "M",

"SubAddr": "",

"Subregion": "Lake County",

"Territory": "",

"Type": "City",

"URL": "",

"UnitName": "",

"UnitType": "",

"X": -87.33716999999996,

"Xmax": -87.25316999999995,

"Xmin": -87.42116999999996,

"Y": 41.60369000000003,

"Ymax": 41.68769000000003,

"Ymin": 41.519690000000026,

"Zone": ""

},

"score": 100,

"extent": {

"xmax": -87.25316999999995,

"xmin": -87.42116999999996,

"ymax": 41.68769000000003,

"ymin": 41.519690000000026

},

"spatialReference": {

"latestWkid": 4326,

"wkid": 4326

},

"searchText": "Gary, IN, USA",

"candidates": [

{

"address": "Gary, IN, USA",

"location": {

"y": 41.60369000000003,

"x": -87.33716999999996

},

"attributes": {

"AddBldg": "",

"AddNum": "",

"AddNumFrom": "",

"AddNumTo": "",

"AddRange": "",

"Addr_type": "Locality",

"BldgName": "",

"BldgType": "",

"Block": "",

"City": "Gary",

"Country": "USA",

"DisplayX": -87.33716999999996,

"DisplayY": 41.60369000000003,

"Distance": 0,

"District": "",

"ExInfo": "",

"LangCode": "ENG",

"LevelName": "",

"LevelType": "",

"Loc_name": "World",

"LongLabel": "Gary, IN, USA",

"Match_addr": "Gary, Indiana",

"MetroArea": "Chicagoland",

"Nbrhd": "",

"Phone": "",

"PlaceName": "Gary",

"Place_addr": "Gary, Indiana",

"Postal": "",

"PostalExt": "",

"Rank": 8.02,

"Region": "Indiana",

"RegionAbbr": "IN",

"Score": 100,

"Sector": "",

"ShortLabel": "Gary",

"Side": "",

"StAddr": "",

"StDir": "",

"StName": "",

"StPreDir": "",

"StPreType": "",

"StType": "",

"Status": "M",

"SubAddr": "",

"Subregion": "Lake County",

"Territory": "",

"Type": "City",

"URL": "",

"UnitName": "",

"UnitType": "",

"X": -87.33716999999996,

"Xmax": -87.25316999999995,

"Xmin": -87.42116999999996,

"Y": 41.60369000000003,

"Ymax": 41.68769000000003,

"Ymin": 41.519690000000026,

"Zone": ""

},

"score": 100,

"extent": {

"xmax": -87.25316999999995,

"xmin": -87.42116999999996,

"ymax": 41.68769000000003,

"ymin": 41.519690000000026

},

"spatialReference": {

"latestWkid": 4326,

"wkid": 4326

}

}

]

},

"Allowed_message": null

}

}

0 Kudos