Answered

Data Model

Hi there,

I have a question regarding the data model. I have created a form, where user can select products form a cascading combo. I would like to display the current stock of the selected product to the user. Furthermore, when he types in the amount he would like to purchase, the stock should be decreased by this amount after saving.

Where should I create the stock column? Parameter or Master entity?

I tried it with the master entity but wasn't able to get it to be displayed in the form in connection with the selected product.

Thanks in advance

photo
0

Hi Bartos,

Parametric entities cannot be modified in the context of a process (unless you create a webservice that interacts with the SOA layer to change it).

Products are a "good" candidate in certain scenarios to be parametric entities but the stock is not since it should be changed in the context of a process.

The problem is if there are two processes running at the same time and affect the same product. What you are suggesting would be to just change a value in a cell and if the stock is 50 and purchase 1 is for 10 units and purchase 2 is for 15 units... there can be a problem when running since you can end up with three scenarios:

  1. 50 - 10 = 40
  2. 50 - 15 = 35
  3. 50 - 10 - 15 = 25 (expected result)

What is usually done is that each product is involved in a transaction. Could be a inventory transaction table or something like this. So the stock is actually the sum of all transactions involving this product.

So when your company buys product this table has positive quantities in the transaction.

When the company sells products it has negative quantities.

I hope you get the idea.

Though it is possible, it might be a little tricky to make the inventory system in BizAgi, you might want to see a separate inventory management system that you can interact with using web services.

Best regards,

Jaime