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 - 2,566 through 2,580 (of 2,864 total)
  • Author
    Search Results
  • #32065
    Brendan
    Keymaster

    Hi Federico,

    The scripts only get executed on the same form they’re referenced from. It happens when you call setFieldValue(field_id, value); I don’t traverse all of the linked fields to execute script fields on them.

    #32064
    Federico Martinez
    Participant

    if that field being edited is referenced. If so, then it executes that script.

    Hi Brendan,

    But this does not happen if it is edited from another script right? or at least not one in another form?

    right now I was trying to do scripts between 3 forms an independent scoring form, a capture form and a brain form that does what I need it to do. they all work great independently but to see the changes I have to wait until its done and then hit the refresh records for the other scripts to do their things. In my capture form its not a big deal but it is in my scoring form. I am taking advantage of the “link to form join” I can go around this by making more functions on the brain side and duplicating the other scripts. just wanted to make sure this is intended and not a bug.

    Thanks!!

    #31740
    Ron
    Participant

    It is a many to many. The script returns the correct value but when looking at the console log it gives the error.

    #31738
    Ron
    Participant

    After refreshing the record single column list the script field displays the correct result. The console log continues to display the same error.

    #31737
    Ron
    Participant

    Thanks for the example. I was able to adapt it to my form and when I run the script it returns the expected result, but it is not displayed in the script field on the layout. The console log returns this error:
    s_Doc: TypeError: undefined is not an object (evaluating ‘med_doctor[0].getFieldValue’), column:25, line:3
    s_Doc is the name of the script field.

    var med_doctor = record.getFieldValue('fld-84c907c7af3c49daa19ca1e30975bc1b');
    if(med_doctor){
    var Name = med_doctor[0].getFieldValue('fld-b1cfe8adec9b4d7397683b068a262cc2');
    Name;
    }

    med_doctor is the parent form and the var Name receives the correct value from the Name field of med_doctor.
    The error does not show in the script edit window when the run button is clicked, it only shows in the console if I click the save button and then open the log.

    #31733
    Ron
    Participant

    I have attempted to create a script field to return the value from a parent record without success. Could you please give a sample of your script.

    Thanks,
    Ron

    #31726
    Brendan
    Keymaster

    Hi Deborah,

    The reason this doesn’t work the way you would like it to is because a Join Link Type works basically the same way as a Many to Many. That is, you can actually have multiple parent records that all join to the same set of child records using the Join fields.

    So that means that a child cannot get access to just one parent record via the Calculation field.

    However, this is possible by using a Script field and having Tap Forms get the first parent record from the array of parent records and then picking out the value for the field from the parent record.

    #31692
    Brendan
    Keymaster

    Ah yes. The form.getFieldIds() method. I forgot about that.

    You’ll see the File Attachment fields in your form appear on the left panel on the Script editor after the next update.

    #31681
    Brendan
    Keymaster

    Well, it is still needed it seems. I’m not sure why yet. Because an NSArray in Objective-C is supposed to translate into a JavaScript array. But an NSDictionary just translates to a JavaScript Object, which I guess still needs to be stringified.

    #31671
    Daniel Leu
    Participant

    I was wondering how to get to the attachment ID…

    Following scriptlet shows the filename of the first attachment.

    
    var receipt_attachment_id = 'fld-8bbc0b1472a746cabc38f6d7ab045668';
    var receipt = record.getFieldValue(receipt_attachment_id);
    JSON.stringify(receipt);
    var meta = receipt[0];
    if (meta) {
    	meta.filename
    }
    

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

    #31667
    Brendan
    Keymaster

    Hi Guillaume,

    I haven’t opened up the File Attachment field to the Script editor yet.

    Did you get that field ID by changing the field type to something else and then changing it to File Attachment? Because for me File Attachment fields don’t show up in the list of available fields.

    In any case, it should be an array of objects where each object is a dictionary.

    I’ll have to do some tests with this though to see how I can open it up for scripting.

    #31654
    Guillaume Kuster
    Participant

    Hey there,

    I’m trying to get an attachment’s filename as a string and then parse it using regex to populate new records. When trying to get the value of the field:

    var attachments = 'fld-e4657ea48c5a4ff6b82ee2a3c43c96a8';
    var fileObject = record.getFieldValue(attachments);
    console.log(fileObject);

    this outputs

    
    [object Object]
    

    How can get to the properties of that object to get the attachment’s file name? If the form I’ll be using, there will only be one file attachment per record.

    The purpose of all this is that I’m trying to convert a file base invoice archive where file names were following a convention of type YYYY-MM-DD - vendor - amount.

    Thanks!

    -Guillaume

    #31617

    In reply to: Multi-column list view

    Brendan
    Keymaster

    Hi Bryan,

    You could add a Calculation field or a Script field to your Artwork Details form that returns the artist contact name and displays that. That would work without you having to do all that work.

    Thanks,

    Brendan

    #31591
    scneophyte
    Participant

    Hey TF Gurus! I’ve peeked at the template exchange and didn’t see anything. I’m embarking on a new TF database project: a repository for household expenses, specifically for organizing home-buying associated receipts (hooray!).

    As a secondary purpose, I’d like to capture monthly expenses, likely through data-mining electronic downloads of my bank account.

    My idea now is to use a similar framework as I have for my business:
    Form 1: Companies
    Form 2: Expenses
    Form 3: Expense Categories
    Picklist 1: Created from Form 3, used on Form 2

    Form 1 joined to Form 2 on Company Name
    Form 3 joined to Form 2 on Expense Category value

    I’d consider myself a firmly average user of TF. I can code in Python, but don’t know any JS. Just looking for any friendly advice or ideas from other users, or inspiration to spend the time to develop some scripting knowledge, for example to automate the record creation from the bank download.

    Thanks for reading!

    #31578

    In reply to: Shortcuts integration

    Brendan
    Keymaster

    It’s awesome that you’re getting use from Siri Shortcuts integration in Tap Forms. Sometimes you never know how things like that will be used when you build them. The Script field is a super powerful feature in Tap Forms now. So many different things you can do with it. If you have the know-how that is :)

Viewing 15 results - 2,566 through 2,580 (of 2,864 total)