Jan 05, 2024 05:33 AM
Hi
I would like to create a number field "recall" that each time the record is update make something like that: recall = recall +1.
I used the automation with the update record filter and I try to apply formula on the recall filed by used a formula like tahs: SUM({recall}, 1) but it is returned an error about the format of the value.
Do you have idea how to increment the value?
For the moment I fixed by add string +1 and the result is "+1+1+1+1+1" for each time the update is execute.
Thanks
Solved! Go to Solution.
Jan 07, 2024 09:47 AM - edited Jan 07, 2024 09:48 AM
Jan 06, 2024 08:48 AM
You can easily do this with a script block. ChatGPT helps write these scripts - I've recorded a little video showing how.
That said, I would pass the Richiami number into the script, then use the newly created number (from the script) as the data to update your field.
Here is the code:
// Get the input number from the previous step
let inputNumber = input.config().inputNumber; // Replace 'inputNumber' with the actual field name or variable name containing the number
// Ensure inputNumber is a valid number or set it to 0 if blank
if (inputNumber === '' || isNaN(inputNumber)) {
inputNumber = 0;
}
// Increment the number by one
const incrementedNumber = inputNumber + 1;
// Save the incremented number as a variable output for future automation steps
output.set('incrementedNumber', incrementedNumber);
Jan 07, 2024 03:14 AM - edited Jan 07, 2024 03:14 AM
No scripts are necessary for this. You just need to change your RICHIAMI field to a number field instead of a text field.
Then, create a new formula field back in your base with the value that you want it to be after running the automation. Your formula field will be RICHIAMI+1.
Then, when you run the automation, just set your number field to the value of the formula field.
Jan 07, 2024 03:30 AM
hi
Thanks for feedback.
I tried this solution but I received a wrong format value.
I resolved by creating a hide string field that adds each time a "+" in the field each, and I created a formula field that counts this "+" in this hide field.
Thanks
Jan 07, 2024 03:37 AM
Thanks for your feedback.
Unfortunately, I have only a free account, and I cannot execute the script, but the solution is very clear.
Jan 07, 2024 09:47 AM - edited Jan 07, 2024 09:48 AM
Good call. This is a more elegant method to the same outcome. 👍
Feb 01, 2024 06:50 AM
Database Schema Design: Begin by ensuring that your database schema includes a dedicated counter field, such as 'change_counter,' associated with the relevant records.
Initialization: Set the initial value of the counter field to zero when creating a new record.
Transaction Management: Implement transactional processes to guarantee atomicity when updating records. This ensures that the counter is incremented only when the entire transaction is successfully completed.
Change Detection Mechanism: Develop a robust mechanism to detect changes in the record. This can include triggers, timestamps, or any other relevant indicators that signify a modification.
Incrementing Counter: Integrate logic of r2 within your application or database triggers to automatically increment the 'change_counter' each time a modification is made to the associated record.
Error Handling: Implement error-handling mechanisms to address any potential issues during the update process, ensuring the counter accurately reflects successful changes.
Logging and Auditing: Consider implementing comprehensive logging and auditing features to track changes and maintain a historical record. This adds an extra layer of accountability and transparency to the system.
Optimization: Regularly optimize the process by assessing the frequency of changes and adjusting the counter incrementation mechanism accordingly. This ensures efficiency and scalability as the system evolves.