Actions and expressions

Im trying to remove stock from my parts table when my maintenance form is filled out and saved.
The entire layout is laid out here pretty well.

I’m thinking I need to create actions on the save of the maintenance form, but I’m hoping there are easier more simpler ways.
All the parts are in a nested table in my maintenance form and these need to be removed from stock.

I think you can achieve this in my previous post ?

I wish,

It has to be through the maintenance form :). This will also be the only way to remove parts as to force this form to be used. Im thinking this will involve some hard expressions. Also this Removal of items needs to be added to the history table for tracking.

Yep, adjust the way to fit your workflow and needs.
There is always a way to achieve a goal with Appsheet, please bear in your mind :blush:.

1 Like

Ive realized that. App-sheet is super powerful :muscle: :muscle: its crazy. They seriously need to display some more super complicated apps for the world to see. No Code is no Joke :grin:

Yes, we can create super complicated app, in terms of App logic, but beauty of Appsheet is easy to handle by app users to play with.

Please feel free to place any query here, you can get loads of helps which I get even now from the community.

Good luck for the time being.

1 Like

FYI this has not been solved despite all the posts :slightly_smiling_face:

I cant seem to get it, I’ve tried many different approaches,

Currently, See below

Any Help would be appreciated :slight_smile:

The solution is not intuitive or straight-forward: you cannot easily make change a row in one table based on an arbitrary row of another table. There’s no way to go to a particular inventory row and tell it to update itself according to some other row. The action that tries to update the inventory row has no way of knowing what maintenance form invoked it, so the action doesn’t know where to get the new values.

Instead, you have to somehow flag the row with the data to use, then direct the row-to-be-updated to find the flagged row and use it. The maintenance form puts a sign up that says, “I have updates!”, then tells the inventory row to update itself. The inventory row must then find the maintenance form with the sign and use the data it finds there. After the inventory has been updated, the maintenance form needs to take the sign down to avoid being counted the next time inventory updates itself.

Another approach is to make the inventory recalculate itself entirely, rather than adjusting itself. With this approach, the inventory looks for all corresponding maintenance form rows and recalculates inventory each time. Since maintenance forms would identify removals from inventory (debits), you’d also need some way to identify additions to inventory (credits), perhaps in a separate table.

Still another approach might be a ledger-style table. When a part is used, an entry is added to the ledger reflecting a debit. When new inventory is received, a entry is added with a credit. Then inventory is just a matter of summing ledger entries of a particular part type.

The ledger approach is best, I think.

3 Likes

I will proceed with the ledger approach. So every time it just calculates and adds and subtracts all the entries to come to the final inventory number for the particular item. Just making sure.

I’m just wondering what would I do for entries that are edited straight in the parts Detail view (Admin only), After a quarterly part recount. As the next firing of the ledger will change it back to the previous number.

Also When Adding an Entry to my Ledger table, I dont want to add it everytime a repair part it used, I only want to enter it when the maintenance form is saved… As they could cancel it. How Do I Loop over the list and Add a row for each part into the ledger. [Part Name “ID”] [Amount Used]

Correct.

Correct, the ledger will change it back to the previous number. Rather than editing the value in the parts row directly, a ledger entry should be added with the intended adjustment. This is the same approach used in accounting to adjust for errors.

From the Maintenance Form, use an action of type Data: perform an action on a set of rows, reference that form’s part rows, and invoke the add-to ledger action for each of those rows.

1 Like

Thanks for the clarity :slight_smile:
So im still wondering,

I have a ledger table

I will put an action to execute on same of the maintenance form.
Add a new row to another table using value from this row.

If there have been multiple parts used how would I take this list and create a new row in the ledger for each part? If it was just 1 part it wouldn’t be a problem, but it could be 10 parts if it was a bad day.

Thanks,

You could provide two actions: one to add a row for a single part, and another to open a new row in a form so the user could enter a quantity.