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 - 631 through 645 (of 3,053 total)
  • Author
    Search Results
  • #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?

    #49351

    In reply to: Name Lookup

    Brendan
    Keymaster

    hi Chris,

    The Child Records Loop snippet is designed to fetch the child records, not the parent record. So in your case, the People form is the parent and the Donations form is the child. So if you wanted to put a field on the People form that say, concatenated all of the donations for that People record together, that’s when you would use the Child Records Loop.

    Yes, Documents are like Databases. Logically and technically as each .tapforms document is actually a folder that contains within it its own SQLite database.

    And yes, Forms are like tables precisely. Records are of course like SQL records and fields are like Table Columns in SQL.

    If you want to automatically connect your forms together based upon some key field, then you would need to use the Join Link Type on your Link to Form field and set the common fields up. Then Tap Forms will auto-join for you.

    But that does in fact change the JavaScript code you would need to get the name values. Because with a Join Link Type, that is in fact the same as an automatic Many to Many relationship. That is, for each Donation record, there technically could be many People records and for each People record there could be many Donation records.

    So now when you get the value of the People field from the record, you’ll get an array instead of just the one object like in my code example. In this case, the Child Records Loop would work as expected.

    Hope that makes sense.

    Thanks,

    Brendan

    #49350

    In reply to: Name Lookup

    Chris Jordan
    Participant

    Hello again Brendan,

    I guess what I was originally trying to do, was write a script that:

    1. Automatically connected each donation to its parent record based on Envelope number.
    2. Automatically fill in the name field based on the Envelope number found in the parent record.

    Number two is what you just helped me with, however I had to manually select the parent record in the Inverse Relationship field, by looking up and connecting the correct Envelope number for the person. I know you have removed the SQL language, however now I have to understand the inner modeling of the application in order to write Javascript to pull the data.

    Still learning,

    Chris

    #49348

    In reply to: Name Lookup

    Brendan
    Keymaster

    By the way, to write that code, all I had to do was double-click on the People field on the left side of the Script Edit window. Then double click on the First Name field. Then all I typed was the return first_name and I wrapped it into a function structure.

Viewing 15 results - 631 through 645 (of 3,053 total)