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 - 241 through 255 (of 2,950 total)
  • Author
    Search Results
  • #51300
    Victoria Herring
    Participant

    Thank. you Daniel.  I will look at the script at the url and review that info and the above info BUT this is really much more than I thought I wanted or needed…..But will see if I can figure it out and use it – I’ll try to deal with it and report back.

    #51299
    Daniel Leu
    Participant

    Hi Victoria,

    I would use a different approach by using tags. Tags use a text field that contains items separated by commas such as xmas2023, xmas2024.

    1. Create a text field and give it a name such as cards. Then copy the form script from https://lab.danielleu.com/blog/working-with-tags/ and update the two field ids to match your form.
    2. Create a saved search to filter all cards that have the Christmas cards field set
    3. Select that search and run the script to set the xmas2023 tag. Run it a second time to set the xmas2024 tag.
    4. Create saved searches for these two new tags.

    Now you can use xmas2024 saved search to view all candidates for a card. Remove or add the tag by hand or use another saved search on the records you want to update.

    The script allows you to set or clear the same tag on your currently selected saved search. Apart of updating two field ids, there’s no coding involved.

    Hope this helps!

    -Daniel

    Cheers, Daniel

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

    #51297
    Victoria Herring
    Participant

    I really honestly don’t know much about scripting. But I could probably figure it out if I had a little guidance. I have a form I created where I want to copy the information in one field and put it into another field, but that other field needs to be edible without messing up the original field. For example, I have a field for Christmas cards and I have another field for 2023 Christmas cards and I want to move the yes or no from the first field to the 2023 field and then I will go through and add or subtract add add in new information or whatever for this year. I would appreciate some guidance on that.

    #51286
    Chris Templeton
    Participant

    I’ve been trying to get the form to import but so far haven’t. I’ll keep trying on my iphone.

    Thanks for the script,

    Chris

    #51282
    Daniel Leu
    Participant

    How about a saved search that contains the records to be exported. And then use a script to assign the numbers?

    Cheers, Daniel

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

    #51280
    Brendan
    Keymaster

    The photos will be put into a Photos folder for you and the filename is kind of the path to the Photos folder. But not the full path obviously. There could also be multiple photos within a record for a specific field and those will be semi-colon delimited within the photo field.

    If you’re handy with JavaScript you could add a Script field which generates a path (that you specify) for you for every record, then export that.

    #51257
    Daniel Leu
    Participant

    I’m not certain that Brendan’s approach works as expected. The auto-increment number would be independent of the prefix. So you might end with AST001, LLK002, AST003, …. But AST002 would not exist.

    I would use a form script that provides you with the next valid entry. Create a saved search for your prefix’s, and then have a form script analyzes this subset of records and recommends you the next valid number to be used. I do this with barcodes that I assign to my artwork.

    Cheers, Daniel

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

    #51255
    Brendan
    Keymaster

    The trickiest part of your request is to be notified if your sequential number has already been used or not. One way achieve that would be to have a Field script loop through all your records, searching for the value that you just entered and then displaying an alert message.  But it could take a while for 3700 records.

    But the formatting of an index number prefixed with 3 characters would be easily achievable with a Number field with the Auto-increment function enabled and a Calculation field that joins them together using the FORMAT() function.

    For example:

    PREFIX + FORMAT(Number; "000")

    The FORMAT() function will take the Number field and format it so that it contains prefixed 0’s.

     

    Attachments:
    You must be logged in to view attached files.
    #51252
    Brendan
    Keymaster

    Hi Chris,

    There’s no function for accessing the previous record directly. In a Script you could do it, but then you have to fetch the records, then get the record that’s at an index one behind the current record.

    but I have a form and script which you will run on the selected record that can create a new record, copy the data from the original selected record, then switch to the new record.

    Download the attached .tfarc file and import that into your document.

    So what you do is when you have your most recent record selected, run the script called New Mileage Entry (it’ll be on the Scripts tab on the right when you have the Form inspector panel visible). Then type in the new odometer value. Tap Forms will calculate the difference between the previous and new odometer values.

    Hope that helps!

    Brendan

    Attachments:
    You must be logged in to view attached files.
    #51250
    pierrot_rennes
    Participant

    Hi,

    I have 3700 records from a comic book puzzle collection database
    I want to add an index field for classifying boxes according to the collection theme
    examples:
    Asterix = AST
    Lucky Luke = LLK
    etc…
    I would like this field to have a three-digit sequential number and to be notified if it is already used for a theme
    Example: AST001 is already used, I must use AST002
    Is a script possible for this kind of request?
    Thanks in advance

    #51245
    Peter Riley
    Participant

    Thanks Daniel – that works well.  Much appreciated.

    Before this I’ve been fiddling with this script for some time in this and another database document for movies I have watched (it is based on one demonstrated by Sam) but I have had to run it more than once to get the link tables updated, ie the first run gets the json from omdb.com and the console shows that the actors etc are found and suggests they are being added to the link table with this:

    console.log(“Existing actor found – updating link table… ” + candidateRecord);

    record.addRecordToField(candidateField, actors_link_id);

    but the link tables remain blank and I have to run it again to actually populate the table.

    Cheers

    #51238
    Peter Riley
    Participant

    Thanks Brendan,

    Template of the Movies form attached.

    There are also forms for Actors, Directors and Writers.  The way it works is that the IMDB ID is entered into the Movie form, then the script downloads the json from OMDB and populates the form with the movie data.   If an Actor (for example) isn’t found in the Actor table then the name is added to that table, then the Actors, Director and Writers linked tables on the main form are also populated.

    Hope that helps

    P

    Attachments:
    You must be logged in to view attached files.
    #51236
    Brendan
    Keymaster

    Can you please post your script or a template (.tff) that includes the script? Take out any API keys you might have in your code first.

    The scripts do run all in one shot, but the Prompter does interrupt it, but it depends on how the script was written.

    #51233

    In reply to: Add up or down?

    Glen Forister
    Participant

    Thanks for the thought.  That is interesting.

    If I could easily make a duplicate of my TF file and test it, I would try that.  But, I have 79 Forms in my document.  I’ve been burned by tests before.

    It sounds pretty straight forward and if I was just starting out I would try the script, but I have over 200 records now to sort out if things go wrong.

    #51232

    In reply to: Add up or down?

    JScottA
    Participant

    Does this help you? I’ve not tested it but maybe it will spur your creativity for a real solution:

    To achieve the desired effect of consistently placing duplicated records immediately after the original in Tap Forms, a JavaScript-based scripted function could provide a workaround. Here’s a general approach, leveraging the Tap Forms API capabilities found in the documentation:

    1.Retrieve the Current Record’s Position: Identify the position of the original record within the sorted list.

    2.Duplicate the Record: Use the record.duplicate() function to create a copy of the current record .

    3.Insert at Correct Position: Based on the original record’s position in the form’s sorted list, reposition the duplicate if needed. This could be done by iterating over records to ensure the duplicate’s position is adjusted relative to the original.

    Here’s a basic script outline:

    // Retrieve the current record

    var records = form.getRecords();

    var currentRecord = form.getSelectedRecord(); // assuming this is the record to duplicate

    var index = records.indexOf(currentRecord);

    // Duplicate the record

    var duplicatedRecord = currentRecord.duplicate();

    // Reposition the record if needed by sorting again or programmatically moving

    // Example: You might delete and re-add in sorted order if Tap Forms sorting is strict

    form.saveAllChanges();

    This script, while a creative workaround, may have limitations if Tap Forms enforces strict sorting on save, potentially reordering records automatically. Testing would determine if the manual duplication places the record in the intended position consistently.

Viewing 15 results - 241 through 255 (of 2,950 total)