Jump to content
  • 0

Formula To Count Current Inventory



I originally had two fields for my Orders App - Quantity_Ordered and Quantity_Received. When our receiving department gets the materials from the orders in, they select an area it is going to be stored. I now have created two new fields - Quantity_Stored and Quantity_Sent.

Quantity_Stored is suppose to get its initial number from Quantity Received. So, if we received and stored 4 windows, Quantity_Stored will start at 4.

Quantity_Sent is for when we actually send those materials from our shop where it is stored to the job site. Many times we only send parts of the order at a time. I'm trying to figure out how to make Quantity_Stored a formula that is the initial Quantity_Received - Quantity_Sent. However, I am trying to make Quantity_Sent be empty in the table and just execute the formula from the datapage.

I.E. - 5 windows received. All 5 stored in bin A2 in our shop. Our Quantity_Stored is for that order is now 5. In the datapage, the user enters 2 into the Quantity_Sent, and the Quantity_Stored is updated to 3. We repeat the process on a future date, but only send 1 window this time. I don't want Quantity_Sent to be populated with 2 already this time, I just want the user to be able to put in 1 more sent instead of doing the math to put in that 3 have been sent all together.



Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Got this running. Added a couple of fields, made a formula, and added the trigger below. The function works perfectly, however, I can't get "Qty_Sent" to show up on the datapage blank. As of now, the field is populated with the number last entered the previous update. 

Could someone help me with some script to have the text box on Qty_Sent be empty upon loading up the datapage?

This is what I have been trying to get to work, however not having any luck.


Link to comment
Share on other sites

  • 0

Hi @kpcollier,

You can try the code below.

 // This code should set the value of your 'EditRecordOrdering_CompletedOrders_Qty_Sent' field to be blank
document.getElementById("EditRecordOrdering_CompletedOrders_Qty_Sent").value = " ";

If the code above did not work as expected you can try to use the code below.

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {
// Just added this event listener, that will execute once the DataPage is loaded  
document.getElementById("EditRecordOrdering_CompletedOrders_Qty_Sent").value = " ";  

I hope this helps.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...