Sales object fields deducted from Inventory and Delivery obj

Posted by mjmadelo on 02-Apr-2014 03:10

Hi all! I just started exploring Rollbase and my question might just be a little noob. I am working on a simple inventory project where I have a Deliveries object (with fields DeliveryItem, DeliveryQuantity and DeliveryDate) and an Inventory object (with fields InventoryItem, InventoryQuantity ande InventoryDate).

Is there a way that I could automate the values for Sales objects based from the values of the two other objects? For example, let's say I have these records:

_________________________________________________

DeliveryItem      |  DeliverQuantity       |   DeliverDate       |

Tables                  |  10                                |   30-Mar-2014       |

Chairs                  |  10                                |   30-Mar-2014       |

Keyboard             |  10                                |   1-Apr-2014         |

_________________________________________________

InventoryItem   |  InventoryQuantity   |   InventoryDate  |

Tables                  |  2                                 |   30-Mar-2014       |

Chairs                  |  3                                 |   30-Mar-2014       |

Keyboard             |  5                                 |   1-Apr-2014         |

where DeliveryQuantity is the number of items delivered towards a certain store and InventoryQuantity is the number of items left in a certain store after an inventory.

Is there a way to automatically match the two items from Delivery and Inventory and subtract InventoryQuantity from DeliveryQuantity to get SalesQuantity?

Thank you very much! Any response from you guys would be very helpful!

All Replies

Posted by Sopna on 09-Apr-2014 05:28

Hello,

Thanks for providing detail steps. I worked on this and came up with the following method which best suites your scenario.

Create a One-to-One relationship between Deliveries and Inventory object. Similarly create a One-to-One relationship between Inventory and Sales object.

Create an 'Update Field Value' trigger in Inventory object to change 'SalesQuantity' value when 'InventoryQuantity' value is changed. Enter the formula to return the subtracted value in formula field.

Now changing the value in InventoryQuantity field will automate the value for Sales object.

Hope this helps. Please revert back if you have any questions.

Thanks,

Sopna.

Posted by Miguel Saez on 10-Apr-2014 14:37

Hi,

Another way to respond your question, you could create a new field type formula, the idea will be to create a loop calculating the DeliverQuantity, this kind of fields is executed when is representing, that's mean, the value is not stored. You can find more information in Rollbase in Action document page 58.

The code which you should create will be similar to this (please find a application xml file attached with a simple example)

var sumQuantity = 0;

{!#LOOP_BEGIN.R39143} sumQuantity=sumQuantity + {!R39143.inventoryquantity};

{!#LOOP_END.R39143}

return sumQuantity;

 Kind Regards,

Miguel

This thread is closed