How to delete a row from gridField when you pull data from queryEntity?

 Hi there!

I am trying to delete a row from grid field which data is populated using a local variable in with function. This data is pulled using a queryEntity function.

I tried to use the SAIL recipe from https://docs.appian.com/suite/help/17.1/recipe_delete_rows_in_a_grid.html. However, as my local!datasubset is in the with, I am not able to modify this datasubset on Remove button click. Also, I don't want have data variable separate in the load because data is huge.

Can anybody help me in resolving this issue that how to delete a row from gridField when you pull data from queryEntity?

Note: Remove button is not buttonWidgetSubmit. When user clicks Remove, I need to see the grid is updating on the UI immediately.

Thank you!

Here is my code:

load(
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 3,
sort: a!sortInfo(
field: "meetingNotesId"
)
),
local!gridSelection: a!gridSelection(
pagingInfo: local!pagingInfo
),

with(
local!meetingNotesHistoryDataSubset: if(
rule!AI_ER_isNullOrEmpty(
ri!id
),
{},
a!queryEntity(
entity: cons!AI_TEST_NOTES_DSE,
query: a!query(
selection: a!querySelection(
columns: {
a!queryColumn(
field: "meetingNotesId"
),
a!queryColumn(
field: "id"
),
a!queryColumn(
field: "notes"
),
a!queryColumn(
field: "createdDt"
),
a!queryColumn(
field: "currRecInd"
),
a!queryColumn(
field: "user"
),
a!queryColumn(
field: "lastUpdatedBy"
),
a!queryColumn(
field: "lastUpdatedAt"
),
a!queryColumn(
field: "type"
)
}
),
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "id",
operator: "=",
value: ri!id
)
}
),
pagingInfo: local!gridSelection.pagingInfo
)
)
),
{

a!sectionLayout(
label: "Meeting Notes History",
firstColumnContents: {
if(
or(
rule!AI_ER_isNullOrEmpty(
local!meetingNotesHistoryDataSubset
),
rule!AI_ER_isNullOrEmpty(
local!meetingNotesHistoryDataSubset.data
)
),
a!textField(
readOnly: true,
label: "No records available."
),
a!gridField(
columns: {
a!gridTextColumn(
label: "Notes Id",
field: "meetingNotesId",
data: index(
local!meetingNotesHistoryDataSubset.data,
"meetingNotesId",
{}
)
),
a!gridTextColumn(
label: "Created On",
field: "createdDt",
data: index(
local!meetingNotesHistoryDataSubset.data,
"createdDt",
{}
)
),
a!gridTextColumn(
label: "Created By",
field: "user",
data: index(
local!meetingNotesHistoryDataSubset.data,
"user",
{}
)
),
a!gridTextColumn(
label: "Notes",
field: "notes",
data: index(
local!meetingNotesHistoryDataSubset.data,
"notes",
{}
)
)
},
identifiers: enumerate(
length(
local!meetingNotesHistoryDataSubset.data
)
) + 1,
selection: true,
totalCount: local!meetingNotesHistoryDataSubset.totalCount,
value: local!gridSelection,
saveInto: local!gridSelection
)
)
},
secondColumnContents: {}
),
if(
or(
rule!AI_ER_isNullOrEmpty(
local!meetingNotesHistoryDataSubset
),
rule!AI_ER_isNullOrEmpty(
local!meetingNotesHistoryDataSubset.data
)
),
{},
a!buttonLayout(
secondaryButtons: {
a!buttonWidget(
label: "Remove",
style: "DESTRUCTIVE",
disabled: or(
rule!AI_ER_isNullOrEmpty(
local!gridSelection
),
rule!AI_ER_isNullOrEmpty(
local!gridSelection.selected
)
),
confirmMessage: "Please note: the meeting notes will be removed only when the task is submitted.",
value: true,
saveInto: {

a!save(
local!meetingNotesHistoryDataSubset.data,
remove(
local!meetingNotesHistoryDataSubset.data,
wherecontains(
local!gridSelection.selected,
local!meetingNotesHistoryDataSubset.data.meetingNotesId
)
)
),
a!save(
local!gridSelection.pagingInfo.startIndex,
rule!ucReturnNewStartIndex(pagingInfo: local!gridSelection.pagingInfo, length: length(local!meetingNotesHistoryDataSubset.data))
),
a!save(
local!gridSelection.selected, null
)
}
)
}
)
)
}
)
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data