Search Results for 'script'
-
Search Results
-
In a post I received a help from Sam Moffat and Brendan on how to create, from one form, a set of records in a linked form with a form script. (The post: https://www.tapforms.com/forums/topic/how-to-add-more-than-one-record-at-a-time-using-a-form-script/).
The script below work correctly (it creates the records in the link). However, only the first record created in the linked form is linked. The others are not linked, and it is necessary to go through them one by one to create the link.
The field linking the two forms is Link to Form, One to Many.
Is there a way to overcome this? Any help would be gratefully received.
The script:
`// Fields from Time Spent form
var order_of_records_id = ‘fld-d78467379e004205b7893109bca23db2’;
var date_of_activity_id = ‘fld-5b07fd9bb7b441848d31de782bcd8780’;
var time_spent_id = ‘fld-be5bcddb8b46426eb90dded15790ef89’;
var activity_id = ‘fld-160340262dbd416291dbeebd7119bd86’;
var description_of_activity_id = ‘fld-c4316e0ee4e7457b92b2f8cc6f699200’;// Date fields
// Add today’s date
var date_signed = new Date();// Formatted to 23/04/2022 for entry in a time entry
var date_signed_formatted = date_signed.toLocaleDateString(“en-GB”, { year: ‘numeric’, month: ‘long’, day: ‘numeric’ })console.log (date_signed + “\n” + date_signed_formatted);
var output = function printOut(continued) {
if (continued == true) {console.log(heshe + ‘\n\n\n’ + date_signed + date_signed_formatted);
let entries = [{
[order_of_records_id]: “1”,
[date_of_activity_id]: new Date(),
[time_spent_id]: “6”,
[activity_id]: “Calls & emails”,
[description_of_activity_id]: “”
},
{
[order_of_records_id]: “2”,
[date_of_activity_id]: new Date(),
[time_spent_id]: “6”,
[activity_id]: “See and identify client”,
[description_of_activity_id]: “See client at [ ] – identify client by ” + heshe + “United Kingdom of Great Britain and Northern Ireland passport and a second form of identification”
},
{
[order_of_records_id]: “3”,
[date_of_activity_id]: new Date(),
[time_spent_id]: “12”,
[activity_id]: “Discuss client’s document(s)/matter, see client sign document(s)”,
[description_of_activity_id]: “Client [ ]\n\nObtain confirmation that:\n\n(i) client has read the Power of attorney, \n\n(ii) the facts and information contained in the Power of attorney are correct,(iii) client is willing to be bound by the Power of attorney; and \n\n(iv) client is willing to grant the power of attorney in favour of the person(s) named in the power of attorney\n\nOn ” + date_signed_formatted + ” at [ ] and [name of client] signed the power of attorney in favour of person named as the attorney in my presence as a deed with myself acting as a witness”
},
{
[order_of_records_id]: “4”,
[date_of_activity_id]: new Date(),
[time_spent_id]: “12”,
[activity_id]: “Notarise document”,
[description_of_activity_id]: “Prepare covering certificate for 1 document (Power of attorney) and attach the covering certificate to the Power of attorney document – bind, seal and sign”
},
{
[order_of_records_id]: “5”,
[date_of_activity_id]: new Date(),
[time_spent_id]: “6”,
[activity_id]: “Arrange for legalisation/apostille”,
[description_of_activity_id]: “Arrange with legalisation agent to collect 1 document (Power of attorney) and then obtain apostille using normal service of the Foreign, Commonwealth and Development Office, and deliver the documents by courier”
},
{
[order_of_records_id]: “6”,
[date_of_activity_id]: new Date(),
[time_spent_id]: “”,
[activity_id]: “Write up notarial register”,
[description_of_activity_id]: “”
}];
for (let entry of entries) {
let newRecord = record.addNewRecordToField(‘fld-d6d2f3fd370a45c2b0d2b281fe012784’);
newRecord.setFieldValues(entry);
}
document.saveAllChanges();
} else {
console.log (“Cancel button pressed.”);}
}
var heshe;
var heshe_list = [‘his’, ‘her’];let prompter = Prompter.new();
prompter.cancelButtonTitle = ‘Cancel’;
prompter.continueButtonTitle = ‘Continue’;
prompter.addParameter(‘He or she: ‘, ‘heshe’, ‘popup’, heshe_list)
.show(‘Choose whether there is a he or she’,output);`I’m currently testing the trial version. One thing I did was a report that collects data from various forms via a “link to other form” field. So I have three tables of data in there. Then I have a calculation field that basically sums these all up. Basically, fixed expenses, variable expenses, sales and then monthly result = TOTAL(sales) – (TOTAL(fixed_expenses) + TOTAL(variable_expenses))
The problem I face is that this final sum isn’t updated when I update records in the related tables. I can manually update it by double-clicking to open it and then just press save. But it doesn’t update by itself. I have checked that it is NOT set to “calculate only once”.
Is this a bug or a feature where I forgot to set some toggle somewhere, or is there something I can do about it with a script?
Hello,
since the last Tap Forms update, the import from CSV files with the PapaParse script leads from short dates dd.MM.22 to dd.MM.1922. For example, the German date 12.04.22 becomes 12.04.1922 on import. It should be 12.04.2022. That wasn’t a problem in the last version.
Does anyone have an idea to solve this issue without splitting the date and adding 100 to the year? This would lead to an error if the year in the date is really 19xx.
e.g.:... let datum_string = line[0]; let datum = parseDate(datum_string); let conv_date = new Date(datum.getFullYear() + 100, datum.getMonth(), datum.getDate()); ...BTW: Copy&Pasting the short date from the CSV file to the date field works fine.
Thanks in advance.
Chris
Hello everybody,
I like to access the record of a Form F that has a table field T from inside a script field inside T. If I use
record.valuesI get a dictionary of the form{"Id of table field 1" = value of table field 1; "Id of table field 2" = value of table field 2; … }.
But I need to access the value of a specific field of F from inside the script field of the table field T, i.e I need a dictionary of the form
{"Id of field 1 of F": value of field 1 of F; "Id of field 2 of F": value of field 2 of F; …}.
Is this possible?
Cheers
This is such a basic question, Im sure it’s been asked but I can not find the answer.
For Example Main Form is a Customer
Linke form is list of ordersI want to show the latest order date, from the order form , on the Parent Customer Form. So I can see it on the Record list for the Customers.
Oh, yes. I am using a JOIN relationship which is working perfectly.
I can not find a way to get the ‘MAX’ date in a Calculated field. I prefer to not use scripting .
I am using IOS (I do have Mac also)
Please any help is appreciated.
THanks Bernie