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,731 through 2,745 (of 3,049 total)
  • Author
    Search Results
  • #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

    #32257
    Brendan
    Keymaster

    Hi Julie,

    The reason you’re only seeing 2 fields is because your Contacts form probably has the Single Column List View Fields set to 2. So you might want to change that. You do that by clicking the Form button and scrolling down the list of form properties and clicking on the 1 – 5 value.

    You can also drag the fields up and down on the Fields list to change what displays first. You might want to either write a Script field that concatenates the address information together or add a Calculation field to do the same.

    I’m glad you’re looking forward to working with the Scripting support in Tap Forms. It’s really quite amazing what you can do with it!

    Thanks!

    Brendan

    #32253
    Julie
    Participant

    Thanks a lot. I was able to do part of what I wanted. I need to understand all this better. But for now, I am wondering why I (only) see the first two fields of my “contacts” form in my “invoice” form. I actually only want to see the address field.

    By the way, if it changes anything, I finally upgrade to Mojave and the latest Tap Forms.

    Can’t wait to get acquainted with the scripting capability.

    Thanks,

    Julie

    #32241

    In reply to: Nested categories

    Federico Martinez
    Participant

    Did you need a different layout or record form for each category? if not and you just wanted that for hierarchical reason to find things faster, As Brendan said the sort and & group settings are strong enough to sort 2 or 3 levels. And You can do an alternative relatively easy.

    On your inventory form add a field for each category. so 1 field each for Room, category, subcategory. and click on column view then as if you were in an excel spreadsheet you can filter which categories show room 1, category 5 and subcategory 3 if you wanted. And imo for an inventory this a lot better than a nested os x finder type because it allows you choose your own filter so if you want to find all cd’s regardless on what room you can do that.

    if you really wanted to you could do your own filtering form as well on your inventory form add a simple formula field where you put concat(room, category, subcategory).

    Then you make a new form add the 3 same 3 fields room, category, subcategory. you can even put it as a pick list. then you do the same formula field. then add a link to form field select link type join. values from this form use the formula field, match values from linked file formula field as well. and it will populate table like a record selection list. It would have to match all 3 categories. And you can have multiple link to form fields if you wanted to show everything in room, etc..

    So you would have kind of a capture form. and the second be a filter form. or with scripting you can do even more complex stuff depending on your end goal but to be honest the column view with its filters and sorting plus the grouping option Brendan mentioned gives you the capability you need.

    #32139
    Kay Beckham
    Participant

    Edit: Never mind. Thank you for the sample script! And it works wonderfully!

    #32126
    Federico Martinez
    Participant

    yes but even if its in another form? I’m sorry for my insistence, right now its not happening when the script is in a different form without hitting refresh..

    1) records before running script in another form “chain” SS1
    2) Script in form “chain” SS2
    3) records after running script in form “chain” SS3
    4) records after hitting refresh in form “transfer requests” SS4 (how I think it should end up in SS3 without hitting refresh)
    5) Script in form “transfer requests” referencing the same no_match ending in “db86” which should be running without hitting refresh? SS5

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

    The scripts will be executed that reference the no_match_id field. But it won’t go further than that in the hierarchy.

    So whenever you call setFieldValue(), whatever field you pass in will have the scripts that reference that field executed. Tap Forms knows which scripts reference a field if you use the getFieldValue function for the specified field. Whenever you save a script that has getFieldValue(), Tap Forms will record the field that was referenced into a separate array stored on the script field itself. Then when you modify any of those fields, Tap Forms will look at all of the script fields in that form to see if there are any that reference the modified field. If so, then it executes that script field.

Viewing 15 results - 2,731 through 2,745 (of 3,049 total)