
Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Nov 10, 2024 02:58 PM - edited ‎Nov 10, 2024 02:59 PM
I have this table set up where I have a running balance of what being added and taken from a cash register. I am running this script for it:
// change these names to pick a view:
let table = base.getTable('TIN');
let view = table.getView('ALL');
let result = await view.selectRecordsAsync({fields: ['Gross Added or Subtracted']});
let runningTotal = 0;
for (let record of result.records) {
// change the field names here to adapt this script to your base
runningTotal += record.getCellValue('Gross Added or Subtracted');
await table.updateRecordAsync(record, {
'Running Balance': runningTotal,
});
}
BUT, when someone counts the actual amount in the register, I want the running balance field to become equal to the actual count. How to I do this?
2 Replies 2
Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Nov 10, 2024 06:28 PM
Looks like you're re-calculating the totals every time the script is run, is that right? If so, you could just create a formula field that outputs the Actual Tin Count if that exists, and if not, it'll output the Running Balance?

Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Nov 10, 2024 07:21 PM
How?
