hi,
I have a local variable "array of object" ,
I need to update value "seenBy" for one field in all array objects,
a!flatten(a!forEach( items: local!msg, expression: { a!save(fv!item.id,fv!item.id), a!save(fv!item.isDeleted,fv!item.isDeleted), a!save(fv!item.createdBy,fv!item.createdBy), a!save(fv!item.messageText,fv!item.messageText), a!save(fv!item.convId,fv!item.convId), a!save(fv!item.createdOn,fv!item.createdOn), a!save(fv!item.seenby,concat(fv!item.seenBy, concat(tostring(loggedInUser()) , ",") ), ), } ) ), a!startProcess( processModel: cons!COM_Write_AllMsg_SeenBy, processParameters: { allmsg: ri!allmsg, } ),
but the issue is :-
"An error occurred while trying to write to the data store [chatDS]. No values have been written. Details: Could not execute JDBC batch update (APNX-1-4208-004)"
I think its because the expression send empty object to the process model:-
" [id=, convId=, messageText=, createdOn=, createdBy=, isDeleted=, seenBy=] ",
I need something to send the same array of object with same data and just update in "seenBy" field
Discussion posts and replies are publicly visible
Hi Ahmad,
For updating a particular field in a dictionary object, the function updateDictionary() from the "Dictionary Manipulation" custom plug-in would be more helpful. An example code is attached.
a!localVariables( local!msg: { { id: 1, isDeleted: false(), seenBy: "You" }, { id: 2, isDeleted: false(), seenBy: null } }, a!forEach( items: local!msg, expression: updatedictionary( dictionary: fv!item, fieldsAndValues: if( isnull(fv!item.seenBy), { seenBy: "Me" }, { seenBy: concat(fv!item.seenBy, ",", "Me") } ) ) ) )
Hope this helps you.
thanks Selvakumar_Kumarasamy