Process Model error fv!index variable not found! due to foreach inside foreach and unable to differentiate between fv!item. Please help fix the error.

Below is the code being used as part of a wizard which has foreach inside expression of a foreach to set columns size. When this page is added as a startform to be able to show on a Site, the Process model is throwing below error. It could be because it is not able to identify difference between fv!item in both the foreach loops. How to fix this error or add the page to site?

Errors

This process model could not be published due to the following errors. Please correct them before continuing.

 

Code

a!columnsLayout(
columns: a!forEach(
items: enumerate(
if(
mod(
length(
local!data
),
local!maxItemsPerColumn
) = 0,
length(
local!data
) / local!maxItemsPerColumn,
floor(
length(
local!data
) / local!maxItemsPerColumn
) + 1
)
) + 1,
expression: with(
local!indices: enumerate(
if(
(
fv!item * local!maxItemsPerColumn
) > length(
local!data
),
length(
local!data
) - (
(
fv!item - 1
) * local!maxItemsPerColumn
),
local!maxItemsPerColumn
)
) + (
if(
fv!isFirst,
0,
(
fv!item - 1
) * local!maxItemsPerColumn
) + 1
),
a!columnLayout(
width: "AUTO",
contents: {
a!forEach(
items: local!indices,
expression: a!checkboxField(
labelPosition: "COLLAPSED",
choicelabels: local!data[fv!item].text,
choiceValues: {
true
},
value: if(
local!data[fv!item].boolean,
local!data[fv!item].boolean,
null
),
saveInto: {
a!save(
target: local!data[fv!item].boolean,
value: not(
local!data[fv!item].boolean
)
)
}
)
)
}
)
)
),
showWhen: or(local!currentStep = 1)
),

  Discussion posts and replies are publicly visible

Parents Reply Children