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 - 526 through 540 (of 2,951 total)
  • Author
    Search Results
  • #49414
    Brendan
    Keymaster

    hi Alang,

    This can be done if you create a Script field which joins together values from a field that you want to extract from the Link to Form field.

    You could have multiple records in your Link to Form field, so you have to tell Tap Forms which record to get the value from. Or you can just loop through all of the child records and join the values together into a single string. That could then be displayed in the multi-column list view.

    Thanks,

    Brendan

    #49413
    Brendan
    Keymaster

    Hi Wil,

    You can do this sort of thing with a Script.

    Are you able to write JavaScript?

    https://www.tapforms.com/help-mac/5.3/en/topic/scripts

    You would need to use the JavaScript substring() function to extract out the text you want:

    https://www.w3schools.com/jsref/jsref_substring.asp

    And the indexOf() function to locate the string you want to split the text from.

    Not sure how adept at JavaScript you are, but it’s definitely possible to do what you want.

    Thanks,

    Brendan

    #49411
    Tom Seputis
    Participant

    I have a use case of creating some maintenance logs for several items. An example is routine maintenance and replacement items on a CPAP machine. I am having trouble figuring out how to auto populate the next service date. The next service date is based on the specific item and the needed interval. I can get it to add X number of days to the entered current service date. But I can’t adjust the service interval based on the item selected. Trying to do IF “Filter” then interval = 14 and things like that. Only using the DATEADD function has worked for me but I can’t figure out how to make the # of add days a variable.

    Not sure if this can all be done with calculations or needs scripting.

    Simple case with fields and values is as follows:

    Item: From pick list choose. Filter, Tubing.
    Date Serviced: Enter date serviced.
    Next Service Date: Auto calculate based on Item selected and service Interval.
    Comments:

    Service intervals: Filter – 14 days and tubing 90 days.

    An help and or recommendations would be greatly appreciated.

    Thanks,
    Tom

    • This topic was modified 2 years, 6 months ago by Tom Seputis.
    #49395
    Brendan
    Keymaster

    Hi Da,

    You can use the Scripting functionality to post any Tap Forms content to a web service now.

    See the scripting topic in the online user manual here:

    https://www.tapforms.com/help-mac/5.3/en/topic/scripts

    There’s functions for posting and getting content from any web service. There’s even an example script on that page that shows you how to call out to a web service to fetch movie data given a barcode value.

    Thanks,

    Brendan

    #49380
    Victor Warner
    Participant

    Daniel,

    Thank you. You are right I was looking at SQL rather than JavaScript.

    Even replacing OR with || still generated an error. It was only when I realised that there was an extra “(” which caused still caused an error:

    if (DocumentType.includes("passport") || *(*documents_details.includes("passport")) {
    

    before the document_details variable…

    #49379
    Daniel Leu
    Participant

    The SQL documentation doesn’t really help much as this is Javascript that you should refer to: https://www.w3schools.com/js

    The logical OR operation in JS is ||. includes is a method used on arrays, you might look at match instead (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match).

    Cheers, Daniel

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

    #49377
    Victor Warner
    Participant

    I have two variables in a script (DocumentType or Documents_Details). One or the other contains text.

    I wish to see if either of them include a specific word (Passport).

    I set up an IF condition to test:

    `if (DocumentType.includes(“passport”) OR (documents_details.includes(“passport”)) {

    console.log(“there is a passport here”);

    } else {

    console.log(“there is NO passport here”);`

    But get an error message:

    “I-CertDoc: SyntaxError: Unexpected identifier ‘OR’. Expected ‘)’ to end an ‘if’ condition., line:153”

    I tried to follow what is on this page: https://www.w3schools.com/sql/sql_and_or.asp, but it is not producing the desired result. Any help would be gratefully received.

    #49375
    Victor Warner
    Participant

    Daniel,

    Thank you for the information.

    It has to be in JavaScript as is needed for use within a longer script.

    #49372
    Daniel Leu
    Participant

    The easiest I think would be to use a calculation field instead of a script field: DATEADD([date_of_notarial_act];0;0;0;5;0;0;0).

    Or in Javascript

    // Create date object
    let write_up_notarial_register_date = new Date(date_of_notarial_act);
    
    // Add five days to current date
    write_up_notarial_register_date.setDate(write_up_notarial_register_date.getDate() + 5);

    Cheers, Daniel

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

    #49371
    Victor Warner
    Participant

    In a document I have a date field which is referenced such has

    var date_of_notarial_act_id = 'fld-76fd68bf708e4bde87998a0cba32ffcd';
    var date_of_notarial_act = record.getFieldValue('fld-76fd68bf708e4bde87998a0cba32ffcd');

    but I would like to add 5 days to it and then that new date written to another form. Doing something such as:

    var write_up_notarial_register_date = date_of_notarial_act + 5;

    Does not work. Is what I would like to do possible with JavaScript in Tap Forms?

    Any help would be gratefully appreciated.

    #49369
    Pinny Berlin
    Participant

    Hi, I have a To-Do List form with hundreds of records. I am trying to duplicate the form with all of its records so that I can separate my Home tasks and Work tasks into two separate forms.

    I tried to Export a Tap Forms Archive, and then import it back in, but it just overwrites the original form. I want to load it back in as a second, additional form. Then I will delete the Work tasks from my Home form, and I will delete the Home tasks from my Work form.

    What’s the easiest way to do this?

    I am using Tapforms for iOS (and am pretty comfortable using javascript if need be).

    Thanks,
    Pinny

    #49367

    In reply to: Name Lookup

    Chris Jordan
    Participant

    Well, I am giving up on scripts. I keep going round and round with this. I get the script to work in the console window while editing and then I go to the form and the field doesn’t update. I refresh both tables and go back to the script edit window and now the console values don’t work. So frustrating. I think there is an update issue in the software.

    #49362

    In reply to: Name Lookup

    Chris Jordan
    Participant

    That’s a good tip! Thanks Brendan.

    My script still isn’t working the way I wanted it to because in the Donations table I still have to manually select the Parent data in the “People” inverse relationship field. If I don’t select anything my script doesn’t work. I wanted to be able to put the Envelope ID in the Donations record and have it automatically look up all the relevant data in the People table. I don’t know if I am making any sense or not.

    People Donations
    ====== =========
    Envelope Envelope (manually entered)
    First Name First Name (auto fill from the script)
    Last Name Last Name (auto fill from the script)

    Anyway, I think I am going to just have one form and put the Donations on each person’s data in the People table.

    Thanks,

    Chris

    #49357

    In reply to: Print or alert?

    Daniel Leu
    Participant

    You can use console.log() to output variables and text to the console:

    console.log(var);
    console.log("text");

    Depending on the object, you might want to use console.log(JSON.stringify(var)).

    To create an alert, use Utils.alertWithMessage('Script Run Complete!', 'Cool!!!!!');

    Hope this helps!

    Cheers, Daniel

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

    #49356

    Topic: Print or alert?

    in forum Script Talk
    robinsiebler
    Participant

    I am trying to debug a script. How can I print or show an alert?

Viewing 15 results - 526 through 540 (of 2,951 total)