Hi everyone,
I have to solve a problem about deleting an item from a datastore.
I'll explain the flow...
I have a repeat that reads data from a Json file with this structure.
{
"items": [
{
"productcode": "BP-HW-001",
"price": "4500",
"image": "assets/images/order/brainpod-personal.png",
"title": "BrainPod© Personal",
"description": "Versione entry level ideale per un massimo 3 utenti contemporanei"
},
{
"productcode": "BP-HW-002",
"price": "6500",
"image": "assets/images/order/brainpod-team.png",
"title": "BrainPod© Team",
"description": "Versione ideale per un massimo 30 utenti contemporanei"
},
{
"productcode": "BP-HW-003",
"price": "2500",
"image": "assets/images/order/brainpod-onpremise.png",
"title": "BrainPod© On-Premise",
"description": "Installa BrainPod© all'interno del tuo data ceter aziendale"
}
]
}
When I click on an element I write the data into a datastore which has this structure
Data is saved correctly
When I click again I should check if there is already an item with the same product code inside the datastore.
If there is, I have to delete it, otherwise I have to add it.
I created this condition but I think I didn't write the logic well because it doesn't work, it always continues to add the record in the datastore