How do we capture the dateTime stamp of a button click?

Good morning Coda community.

I am a fledling Coda-er (Codar??) and I am working on building a fairly simple inventory management system using a couple of the pre-built templates.

Here is a simple example.

image

I have a list of finished goods that I can sell. When I click add sale it deducts the associated raw materials and increases sale quantity by one.

What I need help with is designing the doc so that each time I click the add sale button it adds the name of the item sold, the quantity and most importantly the transaction date to a transactions table.

Similarly, at the same time if another table could record the raw materials that were consumed, the quantities and the transaction date (same as the transaction date in the previous table) that would round it all out.

I am going to be researching further, but would greatly appreciate any help that you can provide :slight_smile:

Sid

Hey there! I can definitely help you out in getting these aspects of your doc working. It would be super helpful though if you could provide a link to a dummy-doc or copy of your doc!

Is that possible?

Please above for a link to the doc. In it you will find four sections.

Section 1: Managing Production

This section is where users will go to record which procedure was sold that day. When the user clicks on the “Add a Sale” button it will add one to the quantity sold.

In addition, I would like to have another page created that will contain a table that will provide timestamps whenever one of the “Add a Sale” buttons is clicked.

The format should be something like

Procedure | Sales Price | Transaction Date Time

Furthermore, the most important new page will be one that will update based on the items that were consumed as part of the Procedure.

Section 2: Dental Procedures

This page contains a list of the items and their related quantities that are consumed by each procedure. Each time a Procedure is sold, the quantity of items will decrease in inventory by the quantity specified on this page.

I would like to capture, in a similar fashion to the Procedure, the following:

Item | Quantity Used | Cost per Unit | Transaction Date Time

Greatly appreciate any help you can provide Scott. More than willing to hop on a zoom call or something to work through this as needed.

Sid

Hey there!

Do you mind shifting the sharing settings so that “Everyone who has the link can edit” or share the doc directly with me → scott@simpladocs.com

Just shared directly with you!

Morning Scott.

Took a look at the doc that you had created and as far as I can tell everything is working as expected! Thank you very, very much for helping put that together.

Any chance you could do a quick write up (if you have the time) of how you were able to put this together? As far as I am aware you added an action to the button that when clicked performs updates to the DB tables.

I should be able to parse through this code and figure out what is happening, but am certainly curious to see how you would explain it in your own words given how quickly you were able to put that together.

Sid

In my own words huh?

Three actions:

  1. ModifyRows() - this action is updating the quantity in the menu of procedures, essentially just recording how many times that button has been clicked
  2. AddRow() - to a new table this action is adding when (to the minute) the button was clicked, and records what button was clicked by logging the procedure
  3. FormulaMap() - This one is the most fun. Its essentially creating a list of items through which an addRow action is iterating on top of. This is just keeping track of your items in a new table to keep record

Hopefully that helps some!

1 Like