Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 91 through 105 (of 2,990 total)
  • Author
    Search Results
  • #52857
    David Kramer
    Participant

    Question to Brendan Duttridge – On page 66 of the TFP manual shouldn’t this link to the Client Expenses form NOT the Client Call Log?

    GENERAL QUESTIONS

    (1) Field Types: What is the difference between TEXT field and NOTE fields. Can Notes fields be searched? What is the specifications in terms of number of characters for each?

    (2) Check Box. On my FM database I have Boolean fields. In FM they are either 1 or 0. Then in the layout I describe what the meanings are for 0/1. In TFP do I import them as numeric and can I then convert to a Checkmark. How? Or do I leave them as numeric and maybe a pick list will format numeric into correct items or checkmarks?
    Any ideas are welcome.

    THE FOLLOWING WAS A QUESTION I WAS GOING TO POST – BUT I THINK I HAVE A SOLUTION:

    3)on my FMDB I have 4-tables. Each one has a unique ID. I have exported them from FM as Merge files and massaged in Numbers. I have renamed the FM IDs as -rec_Form_Record_ID and imported as type=numeric.

    Three of the FM tables imported (mostly) correctly but one table reads only 2 records and stops (ignores 150+ records). In Numbers I deleted the first 10 records thinking there was something there causing problems but TFP still only reads 2 records.

    Then I had an idea. I opened the merge file in Excel. Saved it as CSV; changed the name. AND TFP imported ALL the records.
    There was a small problem in that TFP created additional records with field information out of order. However those were easily deleted.

    4) so I have imported my FM data. In each record there is rec_Form_Record_ID. I then redefined the child record id as Link-To the appropriate child record. Moved the link-to field onto the layout. I expected to see the child-records in the parent record. But I Do Not see the child records automatically. I do see the child records if I choose “Select existing linked records.” And manually link them. But not automatically based on stored ID values.
    Note: The import data prefaced the id fields with -rec_Form_Record_ID which I changed to Form_Record_ID once it was imported.

    5) In FM I used a starting value which is different for each table. Since I already have unique ID numbers how do I specify the starting ID number in TFP (starting from the last number ID used and then use an increment.

    6) after a lot of trial/error I was able to format field names and values (stroke/fill). But I could not get TFP to format a button I added to my form?

    7) I’m asking a favor. Can someone write a script for me that when runs opens a layout (1) within this form and or (2) opens a form in a different form. Once I have that as a template I’m sure I can figure out other buttons I need. Thank you.
    Forms:
    – Form1
    – Form2
    – Form3
    Layouts I created:
    – General
    – Instructions
    – Expenses

    Example: From the General layout the user may want to go to the Instructions [button] layout which is within the same form or may want to go to the Expenses [button] layout which is in a different Form.

    Thank you all.

    Glen B
    Participant

    Perhaps I am approaching this wrong.

    Simply put I have two Forms
    Company
    Order

    Company Form has multiple fields but only two that we are needing to work with for this problem
    Company Name
    Company Street

    On the Order Form there are two fields of interest
    Company
    Street

    On the Order Form Company is a Picklist from Company Form using Company Name field for the list

    The problem trying to be solved is that every Company may have multiple Street addresses so on the Order Form I would like to have the field Street be a Picklist based off of the Company selected in the Company field.

    My thoughts are:

    1. Can a script be triggered on the selection of the Company from the Picklist that then generates a list of Street values for that company and those are then populated into the Picklist for Street? Not sure what happens between records as different Companies or different Streets are needed.

    2. Or is there a relational link that can be done between the Street fields that utilizes a filter based on the Company selected.

    Any direction or solutions are appreciated (hopefully I have explained the problem clearly)

    regards,

    #52840
    Daniel Leu
    Participant

    Two things come to my mind:

    1. 1) Is client_first_name_and_email_address_details defined? Maybe the contact details link is missing. In this case I would use if (client_first_name_and_email_address_details == undefined) return; to skip the rest of your script. You might want to add a log message as well.
    2. 2) Did you just migrate to Tap Forms Pro? If yes, client_first_name_and_email_address_details is likely an array. So you might want to use just the first element with client_first_name_and_email_address_details[0].
    • This reply was modified 5 months, 2 weeks ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    Victor Warner
    Participant

    I have a field script in Form which pulls in data from another Form (client_contact_details), which was working the last time I used it, but it is now producing an error:

    Email adress for invoice: TypeError: client_first_name_and_email_address_details.getFieldValue is not a function. (In 'client_first_name_and_email_address_details.getFieldValue(company_name_id)', 'client_first_name_and_email_address_details.getFieldValue' is undefined),line:(null)

    The script is now within a function, so I do not understand the error means. Any help in solving this would be greatly appreciated.

    The script:

    // Return values
    var Dear_Name = "Placeholder";
    var Email_to_send_invoice = "test@example.com";
    
    // Form ID
    var client_contact_details_id = 'fld-c53e48e48e3a40c7a5656ab92f39ecc9';
    var client_first_name_and_email_address_details = record.getFieldValue(client_contact_details_id)
    
    //Company details
    // company name
    var company_name_id = 'fld-a3300e3db044421598ae171c0a2d4834';
    var company_name = client_first_name_and_email_address_details.getFieldValue(company_name_id);
    
    console.log(company_name);
    
    if (company_name == null) {
    // first name of individual
        var first_name_id = 'fld-45599a4f0a6342d8973faed53dfbfed8';
        var first_name = client_first_name_and_email_address_details.getFieldValue(first_name_id);
    
        // Email address of individual
        var email_id = 'fld-8f9a928a7d554527b4127ef811136210';
        var email_individual = client_first_name_and_email_address_details.getFieldValue(email_id);
    
        Dear_Name = first_name;
        Email_to_send_invoice = email_individual;
    } else {
        // first name of company contact
        var first_name_company_contact_id = 'fld-24ee4dae33d941bf81e1667853a7a949';
        var first_name_company_contact = client_first_name_and_email_address_details.getFieldValue(first_name_company_contact_id);
    
        // email address of company contact
        var email_company_contact_id = 'fld-8cfa7613f04f4a8b82652bc27f3c05df';
        var email_company = client_first_name_and_email_address_details.getFieldValue(email_company_contact_id);
    
        Dear_Name = first_name_company_contact;
        Email_to_send_invoice = email_company;
    }
    
    console.log(Dear_Name + " " + Email_to_send_invoice);
    
    Email_to_send_invoice;
    Harry
    Participant

    No problem. I’m sure the launch of TFP has kept you pretty busy.

    In my original post, I used a calculation field to illustrate the problem. But I also use script fields in a few forms to calculate days between dates. The script fields are not working. Here’s a script that I use:

    function Days_Since() {
    
    var today = new Date(Date.now());
    today.setHours(0,0,0,0);
    
    let last_occurence_date = record.getFieldValue('fld-a00b75456ce64c09b3333f5205eebbae');
    last_occurence_date.setHours(0,0,0,0);
    
    var daysAgo = Math.round((today.getTime() - last_occurence_date.getTime()) / 86400000);
    
    if (daysAgo == 0) {
    	return "Today";
    } else {
    	if (daysAgo == 1) {
    	return "Yesterday";
    } else {
        if (daysAgo > 1) {
        return daysAgo + " Days Ago";
        }
    }
    }
    }    
    Days_Since();

    This field returns a text value.

    This field does not update when I pull down on the list. But it does update after I close the form and reopen it. That’s what I’ve been doing. Just a minor inconvenience.

    • This reply was modified 5 months, 3 weeks ago by Harry.
    • This reply was modified 5 months, 3 weeks ago by Harry.
    #52816

    In reply to: Listmonk API

    Daniel Leu
    Participant

    Using a form script with the Tap Forms Pro API (https://www.tapforms.com/help-mac/pro/en/topic/javascript-api), you could publish content from TFP to Listmonk.com.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #52812
    Victor Warner
    Participant

    I would like help with a Form script concerning a prompt.

    The prompt window displays a date field and then 3 further fields:

    1. Field 1: to the type of service,
    2. Field 2: to choose the number of items, and then
    3. Field 3: how to send it items

    It runs from one form (Notarial Act) and once the fields in the Prompt are populated with data, then the script creates a new record with the data entered in another (Linked to) Form (Disbursements). If all 3 fields are populated, 3 records are created in the Linked to Form.

    The script below does this.

    However, I would like to be able to amend the script so that if Field 3 is set to ‘none’, then only 2 records are created.

    Given the way the prompt script is written/structured, I am not sure how to add this option. Any help would be greatly appreciated.

    `

    var date_id = ‘fld-7b9283660edc4c818320ec930d427747’;
    var type_of_disbursement_id = ‘fld-aad6018d791d477f9c0d323c604712a7’;
    var unit_price_id = ‘fld-5dad44183eb04dc38d6c8565e008be25’;
    var no_id = ‘fld-27cb8e3b36c7472eb4967ccb45b804d9’;

    var output = function printOut(continued) {
    if (continued == true) {

    // take date entered in prompt (put into variable date_of_invoice)
    // and format so it can be written

    var vDate_of_invoice_2 = date_of_invoice.replace(/(\d+)\/(\d+)\/(\d+)/, ‘$2\/$1\/$3’);
    var vDate_of_invoice_3 = new Date(vDate_of_invoice_2);

    // var vDate_of_invoice_formatted = vDate_of_invoice_3.toLocaleDateString(‘en-uk’, {year: ‘numeric’, month: ‘2-digit’, day: ‘2-digit’});
    // var vDate_of_invoice_formatted_ISO = vDate_of_invoice_formatted.replace(/(\d+)\/(\d+)\/(\d+)/, ‘$3-$2-$1′);

    if (service_type==’Standard Service’){

    var Type_of_Disbursement_variable = ‘FCDO – apostille (standard service)’;
    var Type_of_Legalisation_Service_variable = ‘Legalisation agent (standard service)’;

    } else {

    var Type_of_Disbursement_variable = ‘FCDO – apostille (restricted urgent)’;
    var Type_of_Legalisation_Service_variable = ‘Legalisation agent (restricted urgent service)’;

    }

    if (service_type==’Standard Service’){

    var cost_of_apostille = ’40’;

    } else {

    var cost_of_apostille = ‘100’;

    }

    if (service_type==’Standard Service’){

    var legalisation_cost = 18 + (18.00 * number_of_apostilles);

    } else {

    var legalisation_cost = 100;

    }

    let entries = [{
    [date_id]: vDate_of_invoice_3,
    [type_of_disbursement_id]: Type_of_Disbursement_variable,
    [unit_price_id]: cost_of_apostille,
    [no_id]: number_of_apostilles

    },
    {
    [date_id]: vDate_of_invoice_3,
    [type_of_disbursement_id]: Type_of_Legalisation_Service_variable,
    [unit_price_id]: legalisation_cost,
    [no_id]: “1”

    },
    {
    [date_id]: vDate_of_invoice_3,
    [type_of_disbursement_id]: “Courier costs (via legalisation agent)”,
    [unit_price_id]: courier_cost,
    [no_id]: “1”

    }

    ];

    for (let entry of entries) {

    let newRecord = record.addNewRecordToField(‘fld-7e308c2071e248fba8012dee54b53b97’);

    newRecord.setFieldValues(entry);

    }

    document.saveAllChanges();

    } else {
    console.log(“Cancel button pressed.”);
    }
    }

    var date_of_invoice;
    var service_type;
    var service_types = [‘Standard Service’,’Restricted Urgent’];
    var number_of_apostilles;
    var number_of_apostillesx = [‘1′,’2′,’3′,’4′,’5’, ‘7’, ‘8’, ‘9’, ’10’];
    var courier_cost;
    var courier_costx = [’75’,’none’];

    let prompter = Prompter.new();
    prompter.cancelButtonTitle = ‘Cancel’;
    prompter.continueButtonTitle = ‘Go’;
    prompter.addParameter(‘Date of invoice: ‘, ‘date_of_invoice’)
    .addParameter(‘Type of Service: ‘, ‘service_type’, ‘popup’, service_types)
    .addParameter(‘Number of apostilles: ‘, ‘number_of_apostilles’, ‘popup’, number_of_apostillesx)
    .addParameter(‘Cost of the courier: ‘, ‘courier_cost’, ‘popup’, courier_costx)
    .show(‘Add date, number of apostilles, service and whether sent by courier’, output);

    `

    #52810
    Brendan
    Keymaster

    Calculation fields can only get an aggregate value from a Link to Form field.

    If you need to pick out specific records and fields from a related form, you’ll need to use a Script field.

    Calculation and Script fields are essentially read-only.

    #52789

    In reply to: Enabling iOS License

    Alan Hayman
    Participant

    Hi, Brendan,
    That doesn’t do it.
    My iPhone is an 8 Plus (I know, it’s obsolete) running iOS 16.7.10, and my iPad is an M1 iPad Pro 13″ running iPad OS 17.6.1.
    In both cases, when I tap the blue “Subscription Options” button from the 10-record limited screen, and then tap “Restore Purchase”, it hesitates for a moment, and then goes back to the 10-record limited screen with the “Subscription Options” button.
    In both cases, I have WiFi turned on, and I have Tap Forms Pro open and running on my Mac.
    Suggestions?
    Thanks.

    #52750
    Glen Forister
    Participant

    That is what I was looking for. I thought I had that answer in my Form of questions in TF, but couldn’t find it. So I went to copy the question and answer to enter it into my Questions form.

    WHAT? I can’t copy any text from this web site anymore. How are we going to copy those Scripts to use in our forms???

    #52737
    Mark Moran
    Participant

    I’m in the process of refining a document. I’ve added a couple of field scripts to several of the forms. The forms alrady have several hundred records. How do I get the form to run the script on all the existing records besides going through each one and clicking the recalculate formulas circled arrow?

    #52713
    karen james
    Participant

    Thanks Brendan. I’ve subscribed to TF Pro on my iPad, I’m just trying to decide which, if any, of the DB’s I haven’t migrated from TF5 are worth it. If TF5 were going to be operable, it’d be a non-issue. So, I’ll take some time with them and see what I want to put my effort into. As for my iMac, I’m just not ready to commit to the subscription only because I’m not sure I need those extra features.

    Daniel, thank you as well. I have 2 iMacs. One is brand spanking new(a lovely gift from my hubs and kids for Mother’s Day) and a 2017 iMac. I could continue to run TF5 on that one. So here’s a question. Will TF5 continue to work on newer iPads once Rosetta 2 is discontinued? I tend to do the majority of my work from my iPad, but it is nice to be able to work from my iMac too.

    • This reply was modified 6 months, 1 week ago by karen james.
    #52703
    Alan Hayman
    Participant

    Hi, Brendan,
    Version 1.07 does not fix this problem.
    I paid the subscription fee when Tap Forms Pro was first released, and I look forward to becoming a steady user, but until this bug is fixed, I will continue to use Tap Forms 5, which works correctly.

    #52694

    In reply to: Apple shortcut support

    Daniel Leu
    Participant

    With Run Script in Tap Forms Pro you can implement all these and have them behave exactly as you’d like.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #52677
    Steve-Kai Vyska
    Participant

    Hello everyone,

    i do not understand, what I’m doing wrong.

    I just want a simple Promt, that asks for one Value when you hit the bottom.

    my script looks like this:
    var varKurzbeschreibung;
    var varStrasse;
    
    var callbackFunction = function() {
    	console.log(varKurzbeschreibung);
    	console.log(varStrasse);
    };
    
    let prompter = Prompter.new();
    prompter.cancelButtonTitle = 'No Thanks';
    prompter.continueButtonTitle = 'Go For It!';
    prompter.addParameter('Kurzbeschreibung', 'varKurzbschreibung','text')
    .show('Neues Haus eingeben', callbackFunction);

    When I Start the script, I get the box withe the labels but I can not enter anything. The box for entering is missing,

    When I add

    .addParameter('Strasse', 'varStrasse', 'popup')
    the box is shown, but also a pickup Box, what I do not want,

    What am I doing wrong?

    Thanks
    Steve

Viewing 15 results - 91 through 105 (of 2,990 total)