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 - 151 through 165 (of 2,866 total)
  • Author
    Search Results
  • #51323
    Surya Paidimarry
    Participant

    Dear Tapforms,
    I have two forms, namely Project and Tasks. I have a linked field called Project Name that connects the Projects form to the child form, Tasks. I’ve created a script to automatically generate a set of tasks. However, I need to update these tasks with the Project Name. I tried using Advanced Find and Replace, but it doesn’t display the linked field, which I learned is a limitation. Manually updating each task is very time-consuming. Could you please suggest how I should proceed? I’ll paste my code for populating the tasks below. Any examples or corrections would be greatly appreciated. I’m not a professional coder, but I can research and accomplish my needs by following examples. Thank you all for your support. Happy TapFarming!

    function Ais_Pum_Default_Tasks() {

    var title_id = ‘fld-a34e5fd309dc4a9385d4b44736547f96’;
    var priority_id = ‘fld-cf942f13d8f14338966a81ccdd30ad81’;
    var category_id = ‘fld-fe9f869cf75a484ab4e3ca70f4c3dc43’;
    var environment_id = ‘fld-4a3951d0ef7b4e24a7affbf0afdbe6e3’;
    var project_name_id = ‘fld-e63dc1cd09cc4448b5d9e92005cb2dcf’;
    var status_id = ‘fld-77ad662cdb234741a5aff92434f600ac’;

    var ServerRequest = form.addNewRecord();
    var InsConfPUM = form.addNewRecord();
    var CFOTool = form.addNewRecord();
    var LoadCustomizationPum = form.addNewRecord();
    var GeneratePreCompares = form.addNewRecord();
    var LoadBugsGenerateCP = form.addNewRecord();
    var PUMDMU = form.addNewRecord();
    var OutageDEVL = form.addNewRecord();
    var PUMDEVL = form.addNewRecord();
    var CheckDevArchiveQuery = form.addNewRecord();
    var RetroDev = form.addNewRecord();
    var OutageTest = form.addNewRecord();
    var PUMTEST = form.addNewRecord();
    var CheckTestArchiveQuery = form.addNewRecord();
    var HandOffCollegeTesting = form.addNewRecord();
    var TestingSignOff = form.addNewRecord();
    var CMticketProd = form.addNewRecord();
    var PUMPROD = form.addNewRecord();

    ServerRequest.setFieldValues({[title_id] : “PUM Server Selection”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “N/A”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    InsConfPUM.setFieldValues({[title_id] : “Install and Configure PUM”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “N/A”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    CFOTool.setFieldValues({[title_id] : “Configure CFO Tool in PUM”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “N/A”, [project_name_id] : “PUMXXX”, [status_id] : “Differred”});

    LoadCustomizationPum.setFieldValues({[title_id] : “Load Customization in PUM”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “N/A”, [project_name_id] : “PUMXXX”, [status_id] : “Differred”});

    GeneratePreCompares.setFieldValues({[title_id] : “Generate Pre-compares in PUM”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “N/A”, [project_name_id] : “PUMXXX”, [status_id] : “Differred”});

    LoadBugsGenerateCP.setFieldValues({[title_id] : “Load Bugids and generate Change Package in PUM”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “N/A”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    PUMDMU.setFieldValues({[title_id] : “Apply PUM on DMU”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92DMU”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    OutageDEVL.setFieldValues({[title_id] : “Send outage Notice for DEVL”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92DEVL”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    PUMDEVL.setFieldValues({[title_id] : “Apply PUM on DEVL”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92DEVL”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    CheckDevArchiveQuery.setFieldValues({[title_id] : “Run Archive query in Devl”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92DEVL”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    RetroDev.setFieldValues({[title_id] : “Hand off Dev to Development team for Retrofits”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92DEVL”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    OutageTest.setFieldValues({[title_id] : “Send Outage Notice for test environment”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92TEST”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    PUMTEST.setFieldValues({[title_id] : “Aplly PUM on test environment”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92TEST”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    CheckTestArchiveQuery.setFieldValues({[title_id] : “Run Archive query created by Cindy”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92TEST”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    HandOffCollegeTesting.setFieldValues({[title_id] : “Releae environment for college Testing”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92TEST”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    TestingSignOff.setFieldValues({[title_id] : “Testing sign off”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92TEST”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    CMticketProd.setFieldValues({[title_id] : “Open Change Management Ticket for Production move”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92PROD”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    PUMPROD.setFieldValues({[title_id] : “Apply PUM on PROD”, [priority_id] : “High”, [category_id] : “PUM”, [environment_id] : “F92PROD”, [project_name_id] : “PUMXXX”, [status_id] : “NotStarted”});

    document.saveAllChanges();

    }

    Ais_Pum_Default_Tasks();

    #51318
    Glen Forister
    Participant

    The problem of using a Form Copy to test scripts. The copy doesn’t have any data, and so that has to be imported via CSV file.

    The problem with that is the possibility of a missed comma in the data. I discovered that when I use a field with a Pick List (Multi-Value Popover) with more than one item, a comma is inserted. That creates problems with exporting and using CSV files. I tried to find a way to substitute something else like ” – “, or semicolon etc., but I couldn’t find a way to do that.

    Any suggestions?

    #51311

    In reply to: Group summaries

    Glen Forister
    Participant

    Thanks, I took the easy out and got my answers by exporting and using a spreadsheet to remove duplicates.  Interesting way to attack that problem.  I will try the script at a later date when I have a day to devote to that.

    BTW, this brings up the problem of using a Form Copy to test the scripts.  The copy doesn’t have any data, and so that has to be imported via CSV file.

    The problem with that is the possibility of a missed comma in the data.  I discovered that when I use a field with a Pick List (Multi-Value Popover) with more than one item, a comma is inserted.  That creates problems with exporting and using CSV files.  I tried to find a way to substitute something else like ” – “, or semicolon etc., but I couldn’t find a way to do that.

    Any suggestions?

    #51310

    In reply to: Group summaries

    Daniel Leu
    Participant

    The Javascript API doesn’t provide a way to work on groups. The script posted by JScott shows results on all records. This could be enhanced if you can define how the records are grouped.

    Another option would be to work on the current saved search. This would mean that you create a saved search for each group. Then you could replace var records = form.getRecords(); with var records = search.getRecords(); to get the results on the currently selected saved search.

    Oh, ignore the alert(output) command in the script since this is not supported. You could use Utils.alertWithMessage(), but that’s not designed to display multi-line results. The console is your friend.

     

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

    #51309

    In reply to: Group summaries

    JScottA
    Participant

    Glen, I have not tested the answer below, but I hope it helps you. It is from the unofficial custom GPT, Tap Forms 5 Assistant. I suggest you work on a copy of your database when testing this. Good luck!

    To calculate and display the number of unique values for each field (e.g., “Class,” “Order,” “Family,” etc.) in your Tap Forms database, you have two options: either use the app’s built-in features for a manual method or run a script.

    Option 1: Manual Method Using Export and External Analysis

    1.Export the Data:

    •Use Tap Forms’ export functionality to export your data as a CSV file. Instructions for exporting are on page 126 of the Tap Forms manual .

    2.Analyze in Excel/Spreadsheet:

    •Open the CSV in Excel or another spreadsheet tool.

    •Use the “Remove Duplicates” feature for each column to count unique entries.

    Option 2: JavaScript Script in Tap Forms

    If you’d prefer an automated method, you can use Tap Forms’ scripting functionality (JavaScript API) to calculate the unique values for each field. Here’s a sample script you can use:

    Sample Script

    // This script calculates unique values for specified fields in the current form.

    function uniqueValueCounts() {

        var form = document.getFormNamed(‘Museum needs’); // Replace with your form’s name

        var fields = [‘Class’, ‘Order’, ‘Family’, ‘Genus’, ‘Sp’]; // Replace with your field names

        var result = “”;

        fields.forEach(function(fieldName) {

            var field = form.getFieldNamed(fieldName);

            var records = form.getRecords();

            var uniqueValues = {};

            records.forEach(function(record) {

                var value = record.getFieldValue(field);

                if (value) uniqueValues[value] = true;

            });

            result += fieldName + “: ” + Object.keys(uniqueValues).length + ” unique values\n”;

        });

        return result;

    }

    var output = uniqueValueCounts();

    console.log(output);

    alert(output); // Displays the result in an alert box

    How to Use the Script

    1.Go to the Scripts section in Tap Forms and create a new script.

    2.Copy and paste the above JavaScript code.

    3.Modify the form and field names to match your data.

    4.Run the script.

    The output will display the unique value counts for each field in an alert box and in the console.

    For additional details on scripting in Tap Forms, refer to the Tap Forms Scripting 101 Guide.

    If you need further guidance or customization of the script, feel free to ask!

    #51305
    Glen Forister
    Participant

    In the attached is my data with “show group summaries” selected.

    What I would like to have is a way to show the group summaries of each column (field) which is calculated to include the numbers of unique names for each field

    For example, how many different Class names, different Order names, different Family names, different Genus names, different Sp names.

    If that can’t be done, how do I get that information. It doesn’t have to show up on the screen but can I run a script to show me the results?

    I can’t write scripts so I would need help here.

    Attachments:
    You must be logged in to view attached files.
    #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.
Viewing 15 results - 151 through 165 (of 2,866 total)