Solved
only getting last item from query
...
local!cart: rule!AS_Get_Cart(),
...
a!gridLayout(
label: "Editable Grid",
labelPosition: "COLLAPSED",
headerCells: {
a!gridLayoutHeaderCell(label: "Item"),
a!gridLayoutHeaderCell(
label: "Price"
),
a!gridLayoutHeaderCell(
label: "Stock"
),
a!gridLayoutHeaderCell(
label: "Quantity",
helpTooltip: "The number of items you want to buy"
),
a!gridLayoutHeaderCell(
label: "Total Price"
),
a!gridLayoutHeaderCell(
label: ""
)
},
columnConfigs: {
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 4
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 1
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "ICON"
)
},
rows: {
{
a!forEach(
items: local!cart,
expression: a!gridRowLayout(
contents: {
a!textField(
label: "item",
labelPosition: "ABOVE",
value: fv!item.name,
saveInto: {},
refreshAfter: "UNFOCUS",
readOnly: true,
validations: {}
),
a!floatingPointField(
label: "price",
labelPosition: "ABOVE",
value: fv!item.price,
saveInto: {},
refreshAfter: "UNFOCUS",
readOnly: true,
validations: {}
),
a!integerField(
label: "stock",
labelPosition: "ABOVE",
value: fv!item.stock,
saveInto: {},
refreshAfter: "UNFOCUS",
readOnly: true,
validations: {}
),
a!integerField(
label: "quantity",
labelPosition: "ABOVE",
value: fv!item.quantity,
saveInto: fv!item.quantity,
refreshAfter: "UNFOCUS",
required: true,
validations: if(fv!item.quantity>fv!item.stock,"Sorry, we dont have those many items in stock",null())
),
a!floatingPointField(
label: "TotalPrice",
labelPosition: "ABOVE",
value: if(isnull(fv!item.quantity),"$0",dollar(tointeger(fv!item.quantity) * todecimal(fv!item.price))),
saveInto: fv!item.total,
refreshAfter: "UNFOCUS",
validations: {}
),
a!richTextDisplayField(
labelPosition: "COLLAPSED",
value: {
a!richTextIcon(
icon: "times",
link: a!dynamicLink(
label: "Dynamic Link",
saveInto: {
a!deleteFromDataStoreEntities(dataToDelete: a!entityDataIdentifiers(
entity: cons!AS_DataStore_Cart_Pointer,
identifiers: fv!item.name
))
}
),
color: "#ff0000"
)
}
)
}
))
a!localVariables(
local!results:
a!queryEntity(
entity: cons!AS_DataStore_Cart_Pointer,
query: a!query(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 50
)
),
fetchTotalCount: false
).data,
cast(typeof('type!{urn:appian:as}AS_Cart_DataBase'()),
local!results))
So, I have this query and this snippet but the grid is only displaying the last item introduced in my DB, any hint in whats wrong?
