API issues with nested roster preload mappings

Good morning, dear, I am making an assignment with a nested roster but when I enter the second record in the last level it does not let me enter and it records an error.
Json
{
“Responsible”: “184070960”,
“Quantity”: 1,
“QuestionnaireId”: “5e5d139f-d972-4316-bb6a-2664c0e67a7e$1”,
“IdentifyingData”: [

{
  "Identity": "",
  "Variable": "cod_alc",
  "Answer": "14101011012"
},
{
  "Identity": "",
  "Variable": "idg_comuna",
  "Answer": "Valdivia"
},
{
  "Identity": "",
  "Variable": "numero_manzanas",
  "Answer": 2
},
{
  "Identity": "e5d21a5d25a3449b8c39fdc4e2befdea_0",
  "Variable": "cod_dc_zc_mz",
  "Answer": "DC-12/ZC-01/MZ-23"
},
{
  "Identity": "92b1867b11364149933c1abf680c254c_0",
  "Variable": "tipo_asignacion",
  "Answer": 2
},
{
  "Identity": "e5d21a5d25a3449b8c39fdc4e2befdea_1",
  "Variable": "cod_dc_zc_mz",
  "Answer": "DC-12/ZC-01/MZ-24"
},
{
  "Identity": "92b1867b11364149933c1abf680c254c_1",
  "Variable": "tipo_asignacion",
  "Answer": 2
},
{
  "Identity": "965595995a3b4f6f95fc61b4da5bc488_0",
  "Variable": "numero_caras",
  "Answer": 4
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_0",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_0",
  "Variable": "nombre_via_cara",
  "Answer": "INDEPENDECIA"
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_0-1",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_0-1",
  "Variable": "nombre_via_cara",
  "Answer": "RECOLETA"
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_0-2",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_0-2",
  "Variable": "nombre_via_cara",
  "Answer": "PROVIDENCIA"
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_0-3",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_0-3",
  "Variable": "nombre_via_cara",
  "Answer": "LAS REJAS"
},
{
  "Identity": "965595995a3b4f6f95fc61b4da5bc488_1",
  "Variable": "numero_caras",
  "Answer": 1
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_1",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_1",
  "Variable": "nombre_via_cara",
  "Answer": "MAIPU"
},
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_0",
  "Variable": "cant_nros_domicilios",
  "Answer": 3
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0",
  "Variable": "nro_domiciliario",
  "Answer": 112
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-0-1",
  "Variable": "nro_domiciliario",
  "Answer": 114
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-0-2",
  "Variable": "nro_domiciliario",
  "Answer": 115
},
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_0-1",
  "Variable": "cant_nros_domicilios",
  "Answer": 3
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-1",
  "Variable": "nro_domiciliario",
  "Answer": 113
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-1-1",
  "Variable": "nro_domiciliario",
  "Answer": 224
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-1-2",
  "Variable": "nro_domiciliario",
  "Answer": 114
}
,
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_0-2",
  "Variable": "cant_nros_domicilios",
  "Answer": 1
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-2-0",
  "Variable": "nro_domiciliario",
  "Answer": 220
}
,
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_0-3",
  "Variable": "cant_nros_domicilios",
  "Answer": 1
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-3-0",
  "Variable": "nro_domiciliario",
  "Answer": 440
},
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_1",
  "Variable": "cant_nros_domicilios",
  "Answer": 1
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_1-1-1",
  "Variable": "nro_domiciliario",
  "Answer": 5678
}

]
,
“WebMode”: false,
“IsAudioRecordingEnabled”: false,
“Comments”: “Comentario de prueba”
}

Error
{

"Assignment": null,

"VerificationStatus": {

    "Errors": [

        {

            "Code": "PL0008",

            "Message": "Roster record does not have a parent.",

            "References": [

                {

                    "Type": "Cell",

                    "Column": "Rst_manzanas, Rst_caras",

                    "Row": 0,

                    "Content": "1, 1",

                    "DataFile": "Rst_domicilios"

                }

            ]

        },

        {

            "Code": "PL0053",

            "Message": "Inconsistent roster code for numeric roster. Sequence of roster codes should be 0, 1, ... to count of roster instances",

            "References": [

                {

                    "Type": "Cell",

                    "Column": "Rst_domicilios",

                    "Row": 0,

                    "Content": "1",

                    "DataFile": "Rst_domicilios"

                },

                {

                    "Type": "Cell",

                    "Column": "Rst_domicilios",

                    "Row": 0,

                    "Content": "2",

                    "DataFile": "Rst_domicilios"

                }

            ]

        }

    ],

    "WasResponsibleProvided": false,

    "EntitiesCount": 0,

    "EnumeratorsCount": 0,

    "SupervisorsCount": 0,

    "FileName": null

},

"WebInterviewLink": null

}

Thank you in advance for your help
and attentive to your comments

The structure of your questionnaire is unfortunately not clear from the data you post here (and the error that server returns could be little bit more helpful :blush:) but the core of the error is that there must be the correct matching between the data loaded into the roster instances and the trigger variable for that roster. For the numeric roster the number of rows loaded must be equal or smaller than the number you load into the trigger question; for the list or multiselect questions the codes must match etc (Errors in user-supplied files for preloading)

In Survey Solutions every variable is at certain level with a specific level of nesting, which is determined where you position it in the Designer (into which roster). But for every variable it is either no nesting, or first level, or second, etc.

Your JSON query shows a violation of this rule:

Of these two only one may be correct and the other is necessarily wrong. You can’t address the same variable sometimes with one and sometimes with two indices. Please check where the variable is placed according to your questionnaire and correct one or the other (or both).

Good morning gentlemen, I tried several modifications but I always get the same error, I attach a simple test Json which delivers the same error previously reported.

Example:

{
“Responsible”: “184070960”,
“Quantity”: 1,
“QuestionnaireId”: “5e5d139f-d972-4316-bb6a-2664c0e67a7e$1”,
“IdentifyingData”: [

{
  "Identity": "",
  "Variable": "cod_alc",
  "Answer": "14101011012"
},
{
  "Identity": "",
  "Variable": "idg_comuna",
  "Answer": "Valdivia"
},
{
  "Identity": "",
  "Variable": "numero_manzanas",
  "Answer": 2
},
{
  "Identity": "e5d21a5d25a3449b8c39fdc4e2befdea_0",
  "Variable": "cod_dc_zc_mz",
  "Answer": "DC-12/ZC-01/MZ-23"
},
{
  "Identity": "92b1867b11364149933c1abf680c254c_0",
  "Variable": "tipo_asignacion",
  "Answer": 2
},
{
  "Identity": "965595995a3b4f6f95fc61b4da5bc488_0",
  "Variable": "numero_caras",
  "Answer": 2
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_0",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_0",
  "Variable": "nombre_via_cara",
  "Answer": "INDEPENDECIA"
},
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_0",
  "Variable": "cant_nros_domicilios",
  "Answer": 1
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_0-0",
  "Variable": "nro_domiciliario",
  "Answer": 112
},
{
  "Identity": "e5d21a5d25a3449b8c39fdc4e2befdea_1",
  "Variable": "cod_dc_zc_mz",
  "Answer": "DC-12/ZC-01/MZ-24"
},
{
  "Identity": "92b1867b11364149933c1abf680c254c_1",
  "Variable": "tipo_asignacion",
  "Answer": 2
},
{
  "Identity": "965595995a3b4f6f95fc61b4da5bc488_1",
  "Variable": "numero_caras",
  "Answer": 1
},
{
  "Identity": "b619dfd5f0bb4f3686f45e6a95ed2648_1",
  "Variable": "tipo_via_cara",
  "Answer": 1
},
{
  "Identity": "ad2f4b10c6094fa68dd4f764c50a4f3c_1",
  "Variable": "nombre_via_cara",
  "Answer": "MAIPU"
},
{
  "Identity": "8cf84d41d0634d7d8a01147bfd989fb7_1",
  "Variable": "cant_nros_domicilios",
  "Answer": 1
},
{
  "Identity": "a940311d82d943628bf0531f75124b71_1-0",
  "Variable": "nro_domiciliario",
  "Answer": 1123
}

]
,
“WebMode”: false,
“IsAudioRecordingEnabled”: false,
“Comments”: “Comentario de prueba”
}

Error:
{

"Assignment": null,

"VerificationStatus": {

    "Errors": [

        {

            "Code": "PL0053",

            "Message": "Inconsistent roster code for numeric roster. Sequence of roster codes should be 0, 1, ... to count of roster instances",

            "References": [

                {

                    "Type": "Cell",

                    "Column": "Rst_domicilios",

                    "Row": 0,

                    "Content": "0",

                    "DataFile": "Rst_domicilios"

                }

            ]

        }

    ],

    "WasResponsibleProvided": false,

    "EntitiesCount": 0,

    "EnumeratorsCount": 0,

    "SupervisorsCount": 0,

    "FileName": null

},

"WebInterviewLink": null

}

thanks greetings.

  1. The posted query still contains errors. Variable cant_nros_domicilios must be on the deeper level (have two coordinates in the suffix). This is according to the questionnaire structure, which was not posted in this thread, but made clear in a separate discussion.

  2. After the query is corrected, the problem still persists. This has been confirmed with a questionnaire created from scratch and documented as a defect here:
    Unexplained preloading error for assignments created via the API · Issue #1542 · surveysolutions/surveysolutions · GitHub

A fix is pending for this issue of preloading nested rosters.

Survey Solutions v21.09.7 released yesterday comes with a patch that fixes this problem.

Thank you very much for your prompt response and correction.