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.
