The value and selectedLabels lists must be the same length. pickerFieldCustom recursively calling to create multiple fields issue.

So currently I have a forEach loop that calls a picker field, dropdown, and 3 button elements in a interface and it iterates over a dictionary of data passed through by a expression rule. I am getting the following error with the interface: 

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 237]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!forEach [line 245]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!pickerFieldCustom [line 263]: A custom picker component [label="Producing Country"] has an invalid value for "value". The value and selectedLabels lists must be the same length.

The code is as listed as follows:

countryProducerInterfaceLayout:

{
a!forEach(
    items: rule!countryProducerInterfaceFieldData(ri!map),
    expression:
    a!localVariables(
      local!items: fv!item,
      local!count: fv!item.count,
      a!cardLayout(
        contents: {
          a!forEach(
            items: enumerate(local!count),
            expression: 
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!localVariables(
                      local!prodCtryLabel: if(
                        or(
                          isnull(ri!map.dataProdCtry1),
                          length(ri!map.dataProdCtry1) < 1
                        ),
                        null,
                        rule!formatCountryName(
                          rule!queryCountryByGenc3(ri!map.dataProdCtry1)
                        )
                      ),
                      a!pickerFieldCustom(
                        label: local!items.label,
                        labelPosition: "ABOVE",
                        placeholder: "--- Search by Name or GENC 3 ---",
                        maxSelections: 1,
                        suggestFunction: rule!queryCountriesAutocomplete(_),
                        selectedLabels: if(isnull(ri!map.dataProdCtry1), local!prodCtryLabel, ri!map.dataProdCtry1),
                        value: if(
                          local!items.label = "Producing Country",
                          ri!map.pubProdCtry,
                          if(
                            local!items.label="Data Producing Country",
                            ri!map.dataProdCtry1,
                            null
                          ),
                        ),
                        saveInto: {
                          a!save(
                            ri!map.pubProdCtry,
                              if(
                                local!items.label = "Producing Country", 
                                save!value, null
                              )
                          ),
                          a!save(
                            ri!map.dataProdCtry1,
                            if(
                              local!items.label = "Data Producing Country", 
                              save!value, null
                            )
                          )
                        },
                        required: true
                      )
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!dropdownField(
                      label: local!items.label2,
                      labelPosition: "ABOVE",
                      placeholder: "--- Select a Value ---",
                      choiceLabels: local!items.choiceLabels,
                      choiceValues: local!items.choiceValues,
                      value: if(
                        local!items.label = "Producing Country",
                        ri!map.pubProd,
                        if(
                          local!items.label="Data Producing Country",
                          ri!map.dataProd1,
                          null
                        ),
                      ),
                      saveInto: {
                        a!save(
                          ri!map.pubProd,
                          if(
                            local!items.label = "Producing Country", 
                            save!value, null
                          )
                        ),
                        a!save(
                          ri!map.dataProd1,
                          if(
                            local!items.label = "Data Producing Country", 
                            save!value, null
                          )
                        )
                      },
                      searchDisplay: "AUTO",
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!checkboxField(
                      label: "Primary",
                      labelPosition: "ABOVE",
                      choiceLabels: {""},
                      choiceValues: {true},
                      value: {},
                      saveInto: {},
                      choiceLayout: "COMPACT",
                      choiceStyle: "STANDARD",
                      validations: {},
                      align: "CENTER"
                    )
                  },
                  width: "EXTRA_NARROW" 
                )
              }
            )
          ),
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!buttonArrayLayout(
                    buttons: {
                      a!buttonWidget(
                        label: "Remove",
                        icon: "minus",
                        value: local!count - 1,
                        saveInto: local!count,
                        size: "SMALL",
                        style: "LINK"
                      )
                    },
                    align: "END"
                  )
                },
                width: "AUTO"
              ),
              a!columnLayout(
                contents: {
                  a!buttonArrayLayout(
                    buttons: {
                      a!buttonWidget(
                        label: "Add",
                        icon: "plus",
                        value: local!count + 1,
                        saveInto: local!count,
                        size: "SMALL",
                        width: "MINIMIZE",
                        style: "LINK"
                      )
                    },
                    align: "END",
                    marginBelow: "STANDARD"
                  )
                },
                width: "EXTRA_NARROW"
              )
            }
          )
        },
        height: "AUTO",
        style: "NONE",
        marginBelow: "STANDARD"
        ),
      ),
  ),
}

countryProducerInterfaceFieldData:

data:{
    {
      /*Producing Country*/
      label: "Producing Country",
      
      /*Producing Organization*/
      label2: "Producing Organization",
      choiceLabels: {"Option 1", "Option 2", "Option 3", "Option 4",
      "Option 5", "Option 6", "Option 7", "Option 8",
      "Option 9", "Option 10", "Option 11", "Option 12"},
      choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
      
      /*Counts*/
      count: 1,
    },
    {
      /*Data Producing Country*/
      label: "Data Producing Country",
  
      /*Data Producing Organization*/
      label2: "Data Producing Organization",
      choiceLabels: {"Option 1", "Option 2", "Option 3", "Option 4",
      "Option 5", "Option 6", "Option 7", "Option 8",
      "Option 9", "Option 10", "Option 11", "Option 12"},
      choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},

      /*Counts*/
      count: 1,
      
      /*Primary*/
      primeValue: "blah",
      primeSaveInto: "blah"
      
    }
}

The formatCountryName and queryCountryByGenc3 is a name formatter and a query respectively. They are pulling from a record type as well. Let me know if you need anymore information I tried to give you everything I am working with.

  Discussion posts and replies are publicly visible

Parents
  • Hi Kyle,

    As I don't have the ri!map values I'm a bit guessing but it could be the different between blank (or nothing) and null. An blank/empty variable isn't the same as a null variable. I'd try updating the local!prodCtryLabel at line 18 to be "{}" rather than "null" (specifically this would be line 23).

    If this doesn't fix it then it would be extremely helpful to have one code block supplied that I can just copy and paste into a new interface object in order to play around with it myself.

  • This didn't work. I dont know how I can supply one block of code for this, but I can try to get an example to recreate the problem.

    The value of ri!map is a data type we have called maps this is just some fields that are located in here as well! 

  • The main point is we need some data to test with in this variable so that we can replicate and resolve the issue.  If you are able to share the data, you can comment out your picker (so the error subsides), place this paragraph field on your form and copy/paste the value into the thread here.

    a!paragraphField(
      label: "DEBUG: ri!map",
      value: ri!map,
      readOnly: true
    )

  • [uuid=, seriesId=, sheetIdentifier=, edition=, title=, nrn=, nsn=, cancelledSeries=, cancelledSheet=, cancelledEdition=, cancelledNrn=, cancelledNsn=, substitudeSeries=, substitudeSheet=, substitudeEdition=, substitudeNrn=, substitudeNsn=, horizDatumDesc=, horizDatumCode=, vertDatumDesc=, vertDatumCode=, sheetType=, lineItem=, seriesDescription=, scaleCode=, primeGpol=, secGpol=, pubProdCtry=, pubProdCode=, pubProd=, dataProdCtry1=, dataProdCode1=, dataProd1=, dataProdCtry2=, dataProdCode2=, dataProd2=, dataProdCtry3=, dataProdCode3=, dataProd3=, language=, logDate=, mediaType=, entryCompDate=, currencyDate=, dateDescription=, dateCode=, class=, usClassCode=, release=, usReleaseCode=, scale=, lllat=, lllong=, lrlat=, lrlong=, urlat=, urlong=, ullat=, ullong=, outputData=, cadrgCd=, ecrgDvd=, staCompDate=, sxmCompDate=, dlaMebs=, mebsCompDate=]

Reply
  • [uuid=, seriesId=, sheetIdentifier=, edition=, title=, nrn=, nsn=, cancelledSeries=, cancelledSheet=, cancelledEdition=, cancelledNrn=, cancelledNsn=, substitudeSeries=, substitudeSheet=, substitudeEdition=, substitudeNrn=, substitudeNsn=, horizDatumDesc=, horizDatumCode=, vertDatumDesc=, vertDatumCode=, sheetType=, lineItem=, seriesDescription=, scaleCode=, primeGpol=, secGpol=, pubProdCtry=, pubProdCode=, pubProd=, dataProdCtry1=, dataProdCode1=, dataProd1=, dataProdCtry2=, dataProdCode2=, dataProd2=, dataProdCtry3=, dataProdCode3=, dataProd3=, language=, logDate=, mediaType=, entryCompDate=, currencyDate=, dateDescription=, dateCode=, class=, usClassCode=, release=, usReleaseCode=, scale=, lllat=, lllong=, lrlat=, lrlong=, urlat=, urlong=, ullat=, ullong=, outputData=, cadrgCd=, ecrgDvd=, staCompDate=, sxmCompDate=, dlaMebs=, mebsCompDate=]

Children