Hi ,
I have a scenario like I have a local value
local!data :{
{id:1,name:"abc",value1:"No"},
{id:2,name:"def",value1:"No"}
}
Now I am showing this data in a grid and it can be selected so I am selecting the first row and I could able to save the entire row in a variable called
local!dataselected.
Now on click of a button say Edit.
I need to update the value of value1 which is selected to Yes from No
so on click of the button in a!save I am doing this
a!save(local!data.value1,updatearray(local!data.value1,wherecontains(local!selected.id,local!data.id),"Yes")
But I am facing this issues
"Cannot index the property of Cannot index property 'value1' into type List of Dictionary.
I saw a Knowledge base avialble for this but no response.
Can someone help me on this please.!!!
Discussion posts and replies are publicly visible
Hi harshav,
I have found the updatecdt() function works better for this type of functionality. Do you have the CDT Manipulation plug-in installed? https://community.appian.com/b/appmarket/posts/cdt-manipulation
Using that plugin, I mocked up an interface that provides the basic functionality you're looking for.
load( local!pagingInfo: a!gridSelection( paginginfo: a!pagingInfo( startIndex: 1, batchSize: - 1 ) ), local!data: { { id: 1, name: "abc", value1: "No" }, { id: 2, name: "def", value1: "No" } }, { a!gridField( label: "Grid", totalCount: length( local!data ), selection: true, identifiers: local!data.id, columns: { a!gridTextColumn( label: "name", data: index( local!data, "name", null ) ), a!gridTextColumn( label: "value1", data: index( local!data, "value1", null ) ) }, value: local!pagingInfo, saveInto: local!pagingInfo ), a!textField( label: "Selection", value: local!pagingInfo.selected ), a!buttonLayout( a!buttonWidget( label: "Edit", saveInto: a!save( target: local!data, value: updatecdt( local!data, { value1: updatearray( local!data.value1, wherecontains( local!pagingInfo.selected, local!data.id ), "Yes" ) } ) ) ) ), a!paragraphField( value: updatecdt( local!data, { value1: repeat( length( local!data ), "Yes" ) } ) ) } )