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,551 through 2,565 (of 2,875 total)
  • Author
    Search Results
  • #33068
    Ian Heath
    Participant

    I’m making a cataloguing database for things like DVDs and am using the example script in the script help section of this website (which uses the barcode/UPC to do a lookup to the Internet to get the product details). What I would like to do is to have a button on the form to trigger the script (rather than having to select it from the menu, which I feel is less intuitive/convenient), but I don’t think this is possible? (I would love that as an enhancement!). I’ve read a few forum posts on the subject of script updating and aren’t sure what it’s best to do. Since the service used for the lookup is limited re. the number of lookups (for the free service) I want to limit the quantity of lookups, i.e. I was thinking of writing per field scripts that returned the specific value based on when the barcode/UPC value changed, but this would increase the number of lookups. Also I would like to be able to choose when to do a lookup, hence the desire for a button/trigger. Thanks in advance.

    #33061
    Aeron Manabo
    Participant

    Hi,

    I am currently interested with the scripting capability of TapForms to apply on my workflow. I would like to ask for help or maybe scripting samples for this conditions:

    1. To Create a New Record.
    2. To Put the Current Date in a Date Field.

    (Much better if I am able to have a prompt to input details to specific fields [e.g. date, week number, etc.])

    Thank you so much for your help on my learning journey. :)

    #33060
    Brendan
    Keymaster

    Hi Ian,

    I have a fix for that coming in the next update. Sorry about that.

    It’s doing that only if you’re editing a Script field. It doesn’t crash when tapping that button when editing a Form script.

    But all it will have in there is the Run Script command which you can access by tapping the run button on the toolbar above the keyboard.

    Thanks,

    Brendan

    #33058
    Ian Heath
    Participant

    Hi, A newbie here, just purchased this today on iOS and planning to get the macOS version very soon. First impression is very good. No doubt I will have some other questions but my first one is a consistent crash I can cause.

    It’s when I’m looking at a script in the forms view and select the option in the screenshot (top right of screen).

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

    Hi Peter,

    This is because in a Link to Form field there can be multiple child records. So which record are you trying to reference? The Calculation field doesn’t let you reference individual records from a Link to Form field. You can only get an aggregate result. For Number, Calculation, and Rating fields, you can get the Total, Average, Minimum, or Maximum value from the child records for the specified field.

    You will need to use a Script field instead to be able to reference a specific child record from a Link to Form field. Something like:

    function getFirstProjectName() {
       var projects_field_id = 'fld-....';
       var project_name_field_id = 'fld-....';
       var projects = record.getFieldValue(projects_field_id);
       var firstProject = projects[0];
       var projectName = firstProject.getFieldValue(project_name_field_id);
       return projectName;
    }
    
    getFirstProjectName();

    Thanks,

    Brendan

    #33020
    Victor Warner
    Participant

    I am creating a database to record subscriptions and have set up fields to show

    1. name of subscription;
    2. period of subscription (yearly, monthly, 2 yearly);
    3. type of subscription (eg work, domestic, software);
    4. amount of subscription

    among others.

    I can see that one of the options is to group records. If I choose type of subscription and Multi-Column View then I can group on headings for work, domestic, software and choose and as a sort field type of subscription so that within each heading the subscription are sorted by the period.

    As far as I can work out it appears is not possible to have 2 level Group by Records.

    For example, rather than having

    Work
    domain registration,2-yearly,£9.99
    tap forms, monthly, £150.00
    365 office, monthly,£59.00
    office insurance,yearly,£300.00
    professional indemnity insurance,yearly,£1,500.00
    Total £2,108.99

    Instead:

    Work
    2-yearly
    domain registration, £9.99
    £9,99

    monthly
    tap forms,£150.00
    365 office,£59.00
    £209.00

    yearly
    office insurance,£300.00
    professional indemnity insurance,£1,500.00
    £1,800.00

    £2,108.99

    Is this type of 2-level grouping available in Tap Forms?

    #32954
    David Salgueiro
    Participant

    Hi Brendan,

    I’ve noticed a couple of weird things while building my first Form script. Not sure if I’m just being a noob (probably am).

    Does alertWithMessage stop execution? Is this intended behaviour? If so, is there an alternative that won’t halt execution on iOS? Example:

    Utils.alertWithMessage('test', 'this message will display');
    Utils.alertWithMessage('test', 'this message will NEVER display');

    Also:
    Utils.alertWithMessage('test', '0 time: ' + new Date(0));

    Displays:
    test
    0 time: Thu Jan 1 1970 00:00:00 GMT+0000 (GMT)

    However, if I assign that value to a blank date field, formatted to display as HH:mm, with Set Current Time as OFF, using the code:
    record.setFieldValue(test_time_id, new Date(0));

    I get a value of 01:00, when I would expect a value of 00:00.

    If I adjust for it, with the code:
    record.setFieldValue(test_time_id, 0 - 60*60*1000);

    … then I get the value of 00:00.

    (I seem to remember an old TF bug similar to this many, many moons ago — I wonder if it has come back to haunt :) ).

    Thanks for your help, as always.

    Merry Christmas!

    #32911
    neo x
    Participant

    i would like to have an inventory database. 2 forms. 1st for the parts themselves. part #, description, and quantity on hand. 2nd form for transactions. receive a part(s) which adds part with specified quantity, use a part which subtracts it . i have this form with datetime, part number which i want to link to first form and update that quantity, num of parts used or added, why field which has picklist for use, received, transferin, transfer out. i’m not sure how to set up link to type. i would like to take number on hand on first form and update it with quantity changed on second.

    #32783

    In reply to: Count unique records

    Brendan
    Keymaster

    Hi Ted,

    There’s no JavaScript API to update the list of values in a Pick List. But you could do this with a Many to Many Link to Form field. You could have a Bus form that has a Link to Form field connected to an Available Seats form. Then when you click the checkmark button to add a seat to the Link to Form field on your Bus form, Tap Forms will show you only the records that haven’t been linked yet.

    So maybe that’ll help.

    Thanks!

    Brendan

    #32767

    In reply to: Count unique records

    Ted
    Participant

    Is this how I would get a pick list that removes an option that had previously been selected?

    Example: allocating seats on a bus – you can’t sell the same seat twice for the same trip.

    Or is there an easier way without messing with Java Script?

    #32645

    In reply to: Count unique records

    Brendan
    Keymaster

    Hello Krys,

    It depends on what you mean by “unique”. Is there a particular field which defines a value that may have duplicates in it that you want to count the number of unique values for?

    You could do that by writing a Form Script which loops through all the records in your form, getting the value for that field and counting the number of unique values. You could add the value to a JavaScript Set which would guarantee that only unique values are added to it. Then you could just get the size of the Set.

    See this link for info on Sets in JavaScript:

    https://alligator.io/js/sets-introduction/

    Thanks,

    Brendan

    #32567

    In reply to: Watched TV Shows

    Brendan
    Keymaster

    Hi Ryan,

    That’s fantastic! Great job with the scripting!

    Brendan

    #32556

    In reply to: Watched TV Shows

    Ryan M
    Participant

    For those curious, here is the script for pulling the TV show and its episodes from omdbapi.com

    https://gist.github.com/rjames86/d29ae0de333a863c831a8f7379c973e3

    #32553
    Ryan M
    Participant

    Playing around some more with Tap Forms’ scripting. I created a form that lets me pull a TV series from IMDB and then also creates a table within each record with a list of all of the episodes. I have a checkbox that I can check off whenever I watch an episode.

    Couple of nice features:

    • The “Completed” checkbox in the form will check off all of the episodes in the table</l1>
    • If all of the episodes are marked as watched, the “Completed” checkbox will get checked
    • You can add the same series twice. It won’t create a new record. If there are new episodes, it will automatically add them to the existing record.

    To use this, you’ll need to create an API key at http://www.omdbapi.com

    Attachments:
    You must be logged in to view attached files.
    #32338
    David Sieber
    Participant

    Brendan, you mentioned an update in an earlier message on this thread.

    Has it been released?

    I am using the script feature and I’m having trouble with updates not happening when I expect them to.

    In fact, if I hit Command-R to refresh the view, updates on my script fields stop happening completely, until I exit the app and relaunch it. Then they work until I do the next Command-R.

    I’m running 5.3.4 Build 937 on macOS 10.14.1.

    Thanks,

    –david

Viewing 15 results - 2,551 through 2,565 (of 2,875 total)