Last active
March 4, 2022 21:17
-
-
Save benlcollins/5ba425b759aefd77d4469f612fda56d8 to your computer and use it in GitHub Desktop.
Revisions
-
benlcollins renamed this gist
Mar 4, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
benlcollins created this gist
Mar 4, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ /** * MULTIPLIES two number column values and saves into a column * @param tableId - id of the table to read row data from * @param rowId - id of the row to read data from and update * @param lowValue - low value from Table * @param highValue - high value from Table * @param feeValue - fee value from Table */ function multiply(tableId, rowId, lowValue, highValue, feeValue) { // Get the row of data from the table, make sure it exists or abort const row = Area120Tables.Tables.Rows.get('tables/' + tableId + '/rows/' + rowId); if (!row) { console.error('Row does not exist'); return; } // Calculate average const average = (parseFloat(lowValue.replace(',', '')) + parseFloat(highValue.replace(',', ''))) / 2; // Calculate estimated revenue const estRevenue = average * parseFloat(feeValue.replace(',','')); // update the row values row.values['Average'] = average; row.values['EstRevenue'] = estRevenue; // send data back to Tables Area120Tables.Tables.Rows.patch(row, row.name); }