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 - 1,021 through 1,035 (of 2,989 total)
  • Author
    Search Results
  • #46520
    Sam Moffatt
    Participant

    You can do this with a script field and the “child records loop” snippet applied to the field you’re interested in joining together. If you search the forum for “child records loop” you can find some similar examples and the intro to scripting video I did also covers using the child records loop to create a comma separated list.

    #46511
    Prashant M
    Participant

    Our office uses QuickBase as DB , low code application. One of it’s cool features is to summarise the linked records in parent table. Please see screenshot attached.

    This feature can make exporting Linked Records much easier in one single excel or if Tap Forms already can do using script , please advise me

    Attachments:
    You must be logged in to view attached files.
    #46503
    Sam Moffatt
    Participant

    You have two parseDate methods and one will likely mess with the other somewhere. You will need to give them independent names and usually extract them at the top of the script (this is what Daniel was referring to). Perhaps name one parseDate and the other parseTime to reflect that it’s handling a time.

    If you look at the earlier script I posted, I had parseDate prior to the Import_Passport method. If you do something similar with the parseDate and renamed the other one parseTime, it’ll make it a little easier to read and I think should fix the error you’re getting.

    #46502
    Sam Moffatt
    Participant

    1. Conceptually instead of adding the photos to Tap Forms and leveraging the built in functionality which would copy the photo into the document, you upload it to a third party service like S3 that then hosts the file. That gives you a link to the file that you can then include in a website field within Tap Forms. If you have many photos of the same item, I’d suggest that you use a table field where each image file you upload to S3 becomes an entry (Daniel does this and posted one script on opening attachments easily from a table). The image hosting service is somewhat immaterial, so long as you get a link to navigate to it that works on all of your devices. I picked S3 because there are plenty of resources out there on getting started with S3 and it’s relatively inexpensive all told.

    2. Yes, a single user with the macOS version of TF running on a single device can use the feature of the attachment field that allows you to do an “add file alias” which doesn’t trigger a copy of the file into the document however this doesn’t work properly when you move to another Mac and obviously can’t work on iOS. That said in the NAS use case if they don’t have concurrent editing on the NAS, it would probably be ok for it to be shared on the NAS rather than use sync directly but there are not protections against concurrent editing so it could ultimately end up corrupted.

    This is I think the second or maybe third post recently where this has been raised but adding such a feature is non-trivial so might be something for a later version (TF6?) as it would require rethinking a little how attachments (photos and files in general) are stored and maintained. iCloud could also be an answer as well because I think it has blob storage though obviously that limits cross-user sharing as well plus is one of the more expensive platforms (plus you can only buy 2TB off them).

    #46499
    Chris Ju
    Participant

    I have two issues, i can’t solve:

    I have two forms (F1 + F2) and i’m importing via script from csv file. With F1 all fields with dates (e.g. 13.01.2022) are fine using Sam’s function parseDate. But in F2 it doesn’t work. Same format as above and it says “undefined”. What the hell?

    The second issue i have is with time fields. The import file has entries with time stamps (e.g. 17:43:56). Could these fields also be handled as dates? Is there a similar function?

    Thanks for your help…

    #46494
    Sam Moffatt
    Participant

    On iOS when you have a record open you can do “Copy Record Link” via the hamburger menu on the top right to take you back to that record. On the Mac, “Copy Record Link” is under the Edit menu.

    The format is tapformz://record/view/[database ID]/[form ID]/[record ID]. The database ID is a unique identifier for your document, form ID is the internal identifier for the form and similarly record ID for the record. In addition to being able to use the UI to get the values, you can also use record.getUrl() via the Scripting API to chain actions together, embed into logs or use in field scripts. The JavaScript API also covers the ability to call into scripts in Tap Forms from external applications as well which gives you the ability to trigger form scripts with custom data. I have a video on how you can use this to integrate with Siri Shortcuts with barcode scanning of packages as a use case.

    #46492

    In reply to: Updated Script Manager

    Chris Ju
    Participant

    Sam, thank you very much for your script manager. It’s very cool! Have you ever considered including PapaParse? I think MIT-License allows that (https://mit-license.org)…

    #46486
    Chris Ju
    Participant

    Great thanks to Brendan and Sam also from me for that script help… I had also this date issue and that date parse function works great!

    BTW: Is ist possible to get the home directory name?

    #46480
    Sam Moffatt
    Participant

    1. For the first one, if you’re using script or calc fields then they won’t be editable in the multicolumn view. The not visible could just be the field not being selected in your MCLV settings so make sure you check that. That said, if you want to edit the values differently from the model, it sounds like maybe you want to copy default values across which then you can edit later which would be a copying sort of use case? I have a video on a copying use case with link to form fields that might help.

    2. The return Format is what is triggering the field ID to be displayed because your first line sets Format to the field ID, I’ll put a fix for your script below. If you’re using 1:M link to form (from what it looks like maybe not?) then you can use calculation fields to copy values. In this model I’d have a Link to Form 1:M from “Computer Models” to “Computers” with “Show Inverse Relationship” ticked which should let you get single values out.

    3. I could have sworn that interface for existing records had a search box in it but that might only be on the Mac and not on iOS. That might also just be the single select side of the 1:M link type too.

    4. If you fix the field that should fix the print.

    This will fix the format being the field ID:

    
    function getFormat() {
        var Format = '';
        var linked_model = record.getFieldValue('fld-a136f05b49a54749b15bedd371560ce1');
    
        if (linked_model.length > 0) {
            var first_contact = linked_model[0];
            Format = first_contact.getFieldValue('fld-20f1f5ca216a4d7f8108f32be30c22d3');
        }
    
        return Format;
    }
    
    getFormat();
    

    If you end up changing the link around to do 1:M from the Computer models and don’t use the calc field then you’ll have to change this to be just if (linked_model) and you can just use linked_model.getFieldValue.

    #46479

    In reply to: Archiving entries

    Cornelius Fischer
    Participant

    Thx Sam. Sounds like a smart way to handle the relations. I will look into it and also watch your video.

    Lets see if I (without any knowledge about programming/scripting) can rebuild this and update my TapForms. 😎

    #46477

    In reply to: Archiving entries

    Sam Moffatt
    Participant

    For the client who gave you a job that’s a Link to Form 1:M from Client to Job. Tick show inverse to make sure you can select Client from Job.

    For the responsible team member at your client is a Link to Form 1:M from Team Member to Job. Also make sure you tick show inverse for similar reasons.

    Team Member becomes a light weight form that is 1:M from Client to Team Member and 1:M from Contact Details to Team Member. This is a three form JOIN setup which I cover with a book use case. The video on using link to form fields to duplicate records might also help give you an idea. You can add extra fields to Team Member to control if it’s active or not and use scripting to update the data. You can also then use a JOIN type and calc field to filter data as well.

    Check out the videos and see if they help connect some dots and when I’ve got some more time I might see if I can work up a more expanded example.

    #46471
    Kirk Williams
    Participant

    This may be a simple question, but how would I populate the current record’s ID into a field?

    My objective is to make a printable label containing a QR or bar code with the link to the specified record, but I have no idea how to call the “rec-” value into a script or calculation.

    All the posts I’ve found that seem to be relevant to this are directing me to a “Beta Team Membership” page.

    Thanks in advance!

    #46468
    Kirk Williams
    Participant

    Good morning!

    I know populating fields conditionally (based on other fields’ values) is a popular topic, so I’m posing this question as more of a plea for strategic guidance. As I’m sure will become painfully obvious, my experience with coding is entry-level at best.

    The file I’m working with is a pretty basic asset inventory. The example I’ll use is: populating (multiple) spec fields based on the value of another (model) field.

    When adding a new device to my “Computers” form, I need to include specific specifications such as “RAM”, “HD”, “Format”, “OS”, etc. (obviously there are many more).

    Entering these values manually is not only cumbersome but also repetitive since I am often deploying multiple devices with the same characteristics. My goal is to be able to enter a value in the “model” field and have the spec fields automatically populate with that model’s corresponding values.

    To accommodate this, I’ve created a “Computer Models” form containing records for each model and their respective specs. On my “Computers” form, I have a link-to field (“Linked model”) that allows me to select a record from “Computer Models”.

    So here’s where I feel as though I need some strategic assistance. With guidance from other users here, I added script fields that will populate “spec” values based on the “Linked model” value. For example, the “Format” field contains the following code:

    function getFormat() {

    var Format = 'fld-20f1f5ca216a4d7f8108f32be30c22d3';
    var linked_model = record.getFieldValue('fld-a136f05b49a54749b15bedd371560ce1');

    if (linked_model.length > 0) {
    var first_contact = linked_model[0];
    Format = first_contact.getFieldValue('fld-20f1f5ca216a4d7f8108f32be30c22d3');
    }

    return Format;

    };

    getFormat();

    I was elated to see this successfully recognize/return the format for the chosen model, however, I’ve since observed some less-than-optimal behavior with this method:
    1. The “Linked model” value is not visible or editable in multi-column view. For visual representation, I’ve addressed this by simply adding an additional “Model” field and populating it with the text value using the same scripting method as the other spec fields. This solves the visibility issue, but still does not allow me to add/edit records in multi-column view (which I tend to do often).
    2. If a record’s “Linked model” field does not have a value entered, the scripted “spec” fields display the referenced field ID. Having fld-20f1f5ca216a4d7f8108f32be30c22d3 displayed results in a distracting/confusing visual representation. Ideally, I’d like the scripted fields to remain blank (or return a default vale like “unspecified” etc) in this scenario.
    3. Selecting a record in the “Linked model” field feels cumbersome. This is not a huge inconvenience, but ideally, I’d love to be able to enter this value using my keyboard, as I would if it were a text or pick list selection. Currently, I’ve only been able to select a linked record by clicking on “Select existing linked records” and scrolling through the “Computer Models” records.
    4. Exported data displays scripted fields in the same way multi-column view does. Exported records offer the same display as described in item #2 above.

    I’ve seen and tinkered with other methods, including IF/THEN and SWITCH statements, but haven’t been successful at all. Since I’m honestly not sure if my issues are with coding or the core logic behind my strategy, so I’m kneeling before the TapForms gurus here with a plea for guidance.

    Any suggestions or new perspectives on my situation are welcomed and sincerely appreciated!

    Thanks in advance!

    #46467

    In reply to: Table default values

    John McArthur
    Participant

    Hi Daniel,

    I have decided to go down the keep it simple route! (A bit of lateral thinking)
    Once all my data fields have been populated, I can simply reduce the length of the field display dramatically as this will still show the Globe but only a fraction of the link.
    As you mentioned earlier, I too don’t need to know the full link value.
    I’ll just put a Title/Item field in to show a brief description of the file/folder and that should work fine.

    Many thanks for your help but I didn’t want to waste any more of your time on such a small part of my ‘big picture’. :-)

    Cheers.

    #46459

    In reply to: Table default values

    John McArthur
    Participant

    Hi Daniel,

    Yes, to ensure I got the correct ones, I retrieved them specifically whilst in the JavaScript view, from the ‘Available Fields’ ID section.

    Noticed some semi-colons missing so added them. Is this correct?

    This is the code:

    function Attachment_Open() {

    const open_id = ‘fld-4b19c3623b674f13b6d07093f0889cf0’; // checkbox Id
    const link_id = ‘fld-2a2a101bee1e439cbbe098a8051a57fb’; // URL Id

    let open = record.getFieldValue(open_id);
    let link = record.getFieldValue(link_id);

    if (link && open){

    console.log(“Opening URL ” + link);
    Utils.openUrl(link);

    // clear opening flag
    record.setFieldValue(open_id, false);
    form.saveAllChanges();
    }
    }

    Attachment_Open();

Viewing 15 results - 1,021 through 1,035 (of 2,989 total)