Interface Definition: Expression evaluation error: An error occurred while executing a save: Expression evaluation error at function 'wherecontains' [line 69]: Invalid types, can only act on data of the same type (Any Type, Number (Integer))

Certified Senior Developer

Hello Everyone,

 

Can anyone help me with this error, please?

Interface Definition: Expression evaluation error: An error occurred while executing a save: Expression evaluation error at function 'wherecontains' [line 69]: Invalid types, can only act on data of the same type (Any Type, Number (Integer))

Please find the code below.

load(
local!removeFailure: false,
local!removedIDs: {},
local!gridSelection: a!gridSelection(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 10,
sort: a!sortInfo(
field: "id",
ascending: true
)
)
),

local!employeeData:a!queryEntity(
entity:cons!Employee_S_datastoreConstant,
query:a!query(
selection:a!querySelection(
columns:{
a!queryColumn(
field:"id"
),
a!queryColumn(
field:"firstname"
),
a!queryColumn(
field:"lastname"
)
}

),
pagingInfo:local!gridselection.pagingInfo
)
),
/* Set the default paging and sorting config `*/

with(
/* Replace the value of local!employeeData with `a!queryEntity()`, or */
/* `queryrecord()`, or use your own CDT array in todatasubset() */

a!formLayout(
label: "Example: Delete from Grid",
contents:{
a!buttonLayout(
secondaryButtons: {
a!buttonWidget(
label: "Remove",
value: true,
saveInto: {
if(
or(
isnull(local!gridSelection.selected),
length(local!gridSelection.selected)<1
),
local!removeFailure,
{}
),
a!save(local!employeeData, remove(local!employeeData, wherecontains(local!gridSelection.selected,
tointeger(index(local!employeeData,"id",null))))),
if(local!removeFailure,
{},
a!save(local!removedIDs, append(local!removedIDs, local!gridSelection.selected))
),
/*` This sets the start index back by one page when *
* all of the results on the final page are deleted. */
a!save(
local!gridSelection.pagingInfo.startIndex,
if(
local!gridSelection.pagingInfo.startIndex <= length(local!employeeData),
/* If at least as many items as the previous start index exist, use it `*/
local!gridSelection.pagingInfo.startIndex,
/* Otherwise, create a new start index to avoid an error */
if(
length(local!employeeData)<=local!gridSelection.pagingInfo.batchSize,
/* If the last item in the grid was deleted or there are only enough items for one page, use 1 */
1,
/*` If there are multiple pages' worth remaining, adjust the start index so that the last page */
/* of items is shown */
(length(local!employeeData)+1)-local!gridSelection.pagingInfo.batchSize
)
)
),
a!save(local!gridSelection.selected, null)
}
)
}
),
a!gridField(
instructions: if(local!removeFailure, "Select one or more items to remove.", ""),
totalCount: local!employeeData.totalCount,
columns: {
a!gridTextColumn(label: "First", field: "firstname", data: index(local!employeeData.data, "firstname" , {})),
a!gridTextColumn(label: "Last", field: "lastname", data: index(local!employeeData.data, "lastname" , {})),

},
identifiers: index(local!employeeData.data, "id" , {}),
value: local!gridSelection,
saveInto: {
local!gridSelection,
a!save(
local!removeFailure,
if(
or(isnull(local!gridSelection.selected), length(local!gridSelection.selected) < 1),
local!removeFailure,
false
)
)
},
selection: true
),

},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidget(
label: "Submit",
submit: true
)
)
)
)
)

  Discussion posts and replies are publicly visible

Parents Reply Children