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,864 total)
  • Author
    Search Results
  • #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.

    #32114
    Federico Martinez
    Participant

    There are many ways to do this. first you need to specify which episode belongs to which trilogy in here I chose a table within the form because I think its just easy using the specified fields.

    After setting up pick list SS1
    and Setting up form with table SS2

    this code on script SS3:
    I am pretty new to tapforms and there maybe better ways to do this. also you need to replace the field value ID’s with the ones in your own script by pulling them from the available fields.

    // initial variables
    var episode = record.getFieldValue('fld-9e272cfa06144cfe94f46639cc4d651d');
    var table = record.getFieldValue('fld-fd2390f763264167809191f09badbbd2');
    
    //default no match variable in case it is not found.
    var result = "no match"
    
    // for loop to search for a match
    for (var index = 0, count = table.length; index < count; index++){
    
    // table variables
    var episodes = table[index].getFieldValue('fld-8b366549607a4664a2ad3cf9b77676f3');
    var trilogy = table[index].getFieldValue('fld-05603762b3ec47e19cedd2f0c1abc1a3');
    
    // if it finds match returns it.
    if (episodes == episode) {
    console.log(trilogy)
    	result = trilogy
    } else {
    	// false condition;
    }
    }
    result;

    you can hide the table in the form SS4

    Attachments:
    You must be logged in to view attached files.
    #32098
    Kay Beckham
    Participant

    To help save some time, I’ve attempted to write the code on my own by copying and pasting from other tutorials online.

    `var featured_series_id = ‘fld-1410861e610c4cba9abd7683e74d030d’;
    var StarWarsMovie = record.getFieldValue(featured_series_id);
    var StarWarsTrilogy;

    switch (StarWarsMovie)
    {
    case ‘Episode 1’:
    case ‘Episode 2’:
    case ‘Episode 3’:
    something something Prequel Trilogy
    break;
    case ‘Episode 4’:
    case ‘Episode 5’:
    case ‘Episode 6’:
    something something Original Trilogy
    break;
    case ‘Episode 7’:
    case ‘Episode 8’:
    something something New Trilogy
    break;

    So this is where it gets confusing. In the “Edit Field Script” window, I don’t see the option for the field that will run this script. I want the field to show those labels, but I’m kind of at a loss on how to make this happen.

    #32097
    Federico Martinez
    Participant
    var transfers = document.getFormNamed('Transfer requests');
    var pending_id = 'fld-ed603b4c67b14e829a2d96e5d3cab22c';
    var no_match_id = 'fld-7dcda80275e74246bf0bc3bcb5b6db86';
    
    var records = transfers.getRecords();
    
    for (var index = 0, count = records.length; index < count; index++){
      var pend = records[index].getFieldValue(pending_id);
    	
    	if (pend) {	
    	console.log("true");
    	records[index].setFieldValue(no_match_id, true);

    So this won’t execute a script on form “transfer requests”?
    is there a way to call on a script or formula to execute from another script?

    Thanks

    #32096
    Kay Beckham
    Participant

    Hello. I would like some scripting help with a database I’m creating.

    What I would like is to take the contents of a pick list, compare them with a different list (it can be within the script, or it can be referred from somewhere else, doesn’t matter), and then show the entry that matches the conditions. I’ve created a pick list in the preferences of my database.

    To use an example, the pick list has Star Wars Episode 1 to 8. The other list has three entries: Prequels, Original Trilogy, New Trilogy. So if Episode 2 is selected from the pick list, the Script field would show “Prequels”.

    Is this possible?

    #32071
    Ryan M
    Participant

    Thought I’d play around and see if I could come up with a different approach to the same mileage tracker. This would probably be closer to a fuel log rather than a simple mileage tracker.

    The inputs would be:

    – odometer value
    – Price per gallon
    – Gallons filled

    A script would calculate your mileage since last fill up as well as your miles per gallon.

    The script uses the default created date field to sort all records by their created date. This assumes that you’re entering in your mileage log around the time you filled up.

    Here’s the script for those interested

    
    var odometer_id = 'fld-9674e316bfed408ca6710ce81b72bf05';
    var vehicle_id = 'fld-64b0b17a635f49b8b40867e45f8d24db';
    var date_created_id = 'fld-2097149a2eeb4d4e892f13b62de6b5ea';
    
    // sort records in ascending order by date value
    var dateSorter = (a, b) => 
      a.getFieldValue(date_created_id) - b.getFieldValue(date_created_id)
      
    
    var run = () => {
      var vehicle = record.getFieldValue(vehicle_id);
      var odometer = record.getFieldValue(odometer_id);
    
      var records = form.getRecords()
        .filter(r =>  r.getFieldValue(vehicle_id) === vehicle)
        .sort(odometerSorter)
    
      var odometerValues = records.map(r => r.getFieldValue(odometer_id));
      var currentRecordIndex = odometerValues.indexOf(odometer);
      var previousRecordIndex = currentRecordIndex === 0 ? 0 : currentRecordIndex - 1
                     
      var mileageValue = odometerValues[currentRecordIndex] - odometerValues[previousRecordIndex]
    
      return mileageValue;
    }
    
    run();
    
    
    Attachments:
    You must be logged in to view attached files.
Viewing 15 results - 2,551 through 2,565 (of 2,864 total)