Search Results for 'script'
-
Search Results
-
I have a movie database in which I’d like to keep an history of every time I watch my movies. I have a field in which I save the last viewing date. With a script, I was hoping to copy this value to an history table field.
So far, I am able to get the current watched date (console.log shows that I am ok there), add a blank record to my table (I can see that when I run the script manually) but I am at a loss to update this newly added record and trigger the script automatically.
Here’s the script :
function Update_Last_Viewed_Date() {var watched_date_id = ‘fld-0d50c9c744b14f89bcfcaa1295650845’;var date_to_log = record.getFieldValue(watched_date_id);var viewings_id = ‘fld-edf6c517ee814c059b9abe34846eb65c’;var newRecord = record.addNewRecordToField(viewings_id);var date_id = ‘fld-da18c2d927f443a3a5cac5b35f705aff’;record.setFieldValue(date_id, date_to_log);document.saveAllChanges();}Update_Last_Viewed_Date();How can I update the recently added record ? And, most importantly, how do I trigger this script ? I read that it should be triggered automatically since I used “getfieldvalue” of the last viewing date. But it doesn’t. If I input a new value in that field, it doesn’t call the script (because no blank record is added to the table).I added screen captures to better explain what I am trying to do.
Thanks in advance !
Hi guys – I started playing with the field scripts. My first goal, try to use TapForms to generate offers and invoices. Therefore I need to calculate taxes. In my first trial I have a form to generate an offer with 2 positions.
Basic options like:
- Position name
- amount
- hourly rate
- sum (amount*hourly rate)
Now I calculate with a calculation field the net-total from sum-1 and sum-2. Now my taxes script comes into play. Im using a script field with the following script to calculate the tax from the net-total. Thx to ChatGPT by the way for the script (i’m not a programmer)..
// Aufruf der Funktion berechneMehrwertsteuer(); // Funktion zur Rundung auf 0.05 function roundToNearestFiveCents(value) { return Math.ceil(value / 0.05) * 0.05; } // Funktion zur Berechnung der Mehrwertsteuer mit Rundung auf 0.05 function berechneMehrwertsteuer() { // Hole die Nettosumme aus dem Formularfeld var nettoSumme = record.getFieldValue('fld-8b1dde982f4849b7b6980b0a95b49a45'); // Prüfe, ob die Nettosumme gültig ist if (isNaN(nettoSumme)) { console.error('Ungültige Nettosumme'); return; } // Setze den Mehrwertsteuersatz var mehrwertsteuersatz = 8.1; // Berechne den Mehrwertsteueranteil var mehrwertsteueranteil = nettoSumme * (mehrwertsteuersatz / 100); // Runde auf 0.05 genau mehrwertsteueranteil = roundToNearestFiveCents(mehrwertsteueranteil); // Gib das Ergebnis in der Konsole aus console.log('Mehrwertsteueranteil: ' + mehrwertsteueranteil); // Rückgabe des Ergebnisses (falls notwendig) return mehrwertsteueranteil; }
Now my problem, whenever I change something like the amout from pos 1 oder pos 2, the net-total is recalculated but NOT the tax. When I understand the FAQ for script field right, the script should automatically run, when the reference field (record.getFieldValue) changes.
So why is my script not updating my tax field? 🤷♂️
Dear members,
how can I trigger a script if one or more record was deleted?
I have developed code that triggers a script if I added a record, works fine.
Regards from germany,
Torsten
I’ll try to explain my problem as simply as possible. I work with the homeless and am currently in the process of creating a database. Basically, I have to deal with a relatively large number of different people every day who give me individual tasks. I have therefore created a table of tasks to be completed for each client. Now I am looking for a way to display all the tasks in order to get an overview.The idea behind this is that I don’t have to click on each client individually to see what still needs to be done this month, for example.
I could not create a table to import the data from another forumlar. However, linking to the document does not work (as I understand it) even if the data is in a table.
However, I have not found a script option either.Does anyone have any ideas on how I can implement this?