Answered

How to delete an item in database

In my project, it's about the restaurant process. I would like to delete the quantity of each type of meat after the customer click the button "confirm the order"

In database, I set a parameter entity for meat collection. Each type had set for the limited quantity = 100 dishes per day (ex. the limited quantity of Beef is 100 dishes per day) and I used the function "Delete one collection item" and type the following code:

if(<count(steak.meat.quanti)>==1)

{

Me.deleteCollectionItem("steak.meat.quanti");

}

but, it didn't work, the quantity in the database is still the same(=100), I don't know how I do suppose to type the expression code to delete the meat quantity. I have attached the screenshots of my project for more information.

Thank you.

Comments (1)

photo
1

Dear Sirawich,

We're glad to help you. The expression is not working because you're not applying the correct syntax. Attached is the correct syntax of the function, extracted from https://help.bizagi.com/bpm-suite/en/index.html?delete_elements_of_a_collectio.htm.

" The syntax of the functions is as follows:

Me.deleteAllCollectionItems("ProcessEntity.RelationshipToTheCollection")
Me.deleteCollectionItems("ProcessEntity.RelationshipToTheCollection",filtered XPath)
Me.deleteCollectionItem("ProcessEntity.RelationshipToTheCollection",filtered XPath)
"

Best regards.