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,476 through 2,490 (of 2,950 total)
  • Author
    Search Results
  • #35900

    In reply to: Watched TV Shows

    Andrew Mead
    Participant

    Hi

    Ok I have now managed to generate an API key and have pasted that in the script in TF.
    Now when I run the script it asks for a IMDB URL which I paste in (example for The 100 would be https://www.imdb.com/title/tt2661044/ but then the script does not seem to do anything after that.

    Is there something I am missing.?

    Thanks
    Andrew

    #35690
    Steve Cutchen
    Participant

    I’m considering using Tap Forms to design a recipe database. I’d like to have a pick list of ingredients that I select with combo boxes on a layout so they will auto-complete. But I’m not sure how Tap Forms will handle an ingredient that is not currently in the list. Ideally, if no match is found, I’d like the new ingredient to be added to the list. Will a combo box do this? Maybe if I type into a combo box, there’s no match, but then, with the new ingredient typed in I click on something to add the contents to the pick list? Maybe with a script? Is there a better way to do this functionality?

    I need this functionality with more than just the ingredient field. The concept is to prevent duplicates and to ease data entry. Other fields where I’d use this include the recipe source, ingredient measurement title, recipe category, and cuisine type.

    #35661

    In reply to: Scripting Tutorials?

    Brendan
    Keymaster

    Hi,

    Just what you see so far in the online user manual for the JavaScript API and the sample scripts that are there.

    If you look at the Mileage Tracker form sample in the Template Exchange forum, you’ll see a sample script there too.

    #35658
    Shane
    Participant

    It seems that scripting can be a particularly powerful way of augmenting forms. Are there any tutorials or examples on how to use them? I didn’t see anything on the web site.

    Thanks.

    #35622

    In reply to: Great idea ;-)

    Sam Moffatt
    Participant

    With a CouchDB server and a JavaScript frontend, I think someone could actually make this work. I’ve been toying with this on and off for a while but never had the time to finish it off. I started off building a PHP web app frontend but decided that if I could figure out how to join it direct to CouchDB in JS then that’d work better.

    #35257

    In reply to: Printing Tables

    Peter Keenan
    Participant

    OK, got it.
    I’m trying to do two things really. Show an indication of an item that someone wants and eventually be able to search for the total of items that the person has chosen. The “Checkmark” doesn’t work in search and using “Text” with an “X” as a field looks sloppy. That’s why I resorted to a table but that won’t work if I can’t show it in print or pdf form. Not sure if I have the Script-cred to go down that road. I noticed in the help guide that you can get the info out of a table but as I said, I’m too much of an end-user to probably figure it out.

    #35196

    In reply to: Printing Tables

    Brendan
    Keymaster

    A Table field won’t actually print out on the “Table of records” layout. Tap Forms won’t print tables within tables. So that’s why it’s not showing up for you. You would have to make a Script field that perhaps concatenates the contents of your Table field and returns whatever content you want into that field which would display in your report.

    #35132
    Brendan
    Keymaster

    Hi David,

    I’m glad you got it working now.

    You were mixing a Script field with the Calculation field formula I provided.

    Thanks,

    Brendan

    #35129
    David Goodwin
    Participant

    Hi there,
    ,amy thanks for your reply.

    I’m still not sure how I construct the script in the box to make this script work.

    I keep getting error repsonses.

    Could you show me where the field I want to use as a start date (on line 2) should sit within this script.

    many thanks

    Attachments:
    You must be logged in to view attached files.
    #35108

    In reply to: iCloud sync issues

    Sam Moffatt
    Participant

    Could you use the CouchDB based sync instead? I’ve shifted everything over as soon as it was available but this requires setting up a CouchDB server. I have an iMac at home that is always on and I run as my CouchDB server but this does mean that when I’m not at home my changes don’t get automatically sync’d from my devices like they would with iCloud.

    One other thing I’ve been wondering about for a while now is if there is much interest for having a TapForms specific hosted CouchDB set up. Pay as you go, probably one dollar per gigabyte stored per month (most used storage for the month; probably a minimum of $5/month to deal with CC fees and the like), set up with a standard SSL certificate and georeplicated backups. For the most part I rely on my own internal network and VPN into it but I’ve been wondering about setting this up more formally and then seeing if there is external interest.

    A feature that I’d like to see if I can get interest in is being able to provide more uniform support for backups. I have my own scripts that I run internally that do two different sorts of backups (one is like Time Machine and another tries to get every single change). Backups would be charged on a similar cost per gigabyte used model though I wouldn’t want to launch that until there was a user interface for it that doesn’t exist right now. I’ve already used my backup system to restore a field script that was thoughtlessly nuked so I know it works but I’d be looking to build a UI around this. These backups are brick level backups that backup individual records which means you can restore a single entity in Tap Forms (such as a record, a field, a script or even a form) without having to bring the entire Tap Forms document along.

    Is there any interest in that?

    #35096
    Sam Moffatt
    Participant

    It’s actually mostly templated from the snippets, the child records loop snippet looks mostly like the vlookup function and the prompter snippet was in the other form script POC.

    I don’t have dedicated time to commit to extra work, I don’t mind helping ad hoc on the forums though. Something like this is also generically useful and interesting enough.

    #35089
    Sam Moffatt
    Participant

    This will work, it requires using script field instead of calc field but it’s not that bad. You need to tell it the value you want to lookup with, the “join” field (table or link to form), the search field to match the lookup value on and then the field to return.

    Create a new form script called “vlookup” with the following contents:

    function vlookup(lookup, join_field, search_field, return_field) {
    	var entries = record.getFieldValue(join_field);
    
    	for (var index = 0, count = entries.length; index < count; index++){
         	var target = entries[index].getFieldValue(search_field);
    		if (target && target == lookup) {
    			return entries[index].getFieldValue(return_field);
    		}
    	}
    	return "";
    }

    Then create a script field to map the values across:

    form.runScriptNamed('vlookup');
    var addresses_id = 'fld-34e22de8a7cf438fb4a83146108f0511';
    var address_name_id = 'fld-f05929829d674141aaed98efe11e29f1';
    var street_id = 'fld-04ec2a23e3554770b3e1f1d771157dd6';
    var primary_address = record.getFieldValue('fld-9b2865aa57b74b70bd4421b27081d65b');
    
    vlookup(primary_address, addresses_id, address_name_id, street_id);
    

    In the script editor, select the fields from the linked form and use the “ID” button instead of double clicking them to get the var syntax. You’ll want to change the last field to match your fields across.

    I’ve attached a sample archive which should demonstrate what I’m talking about. It also has another form script using a prompter to handle the address change but for some reason the script fields aren’t updating afterwards, you have to manually press refresh on the record.

    Attachments:
    You must be logged in to view attached files.
    #35057

    In reply to: Key Word Automation

    Brendan
    Keymaster

    So you want all the spaces to be replaced with underscores within the value of a field? Is that what you’re wanting?

    If so, you can use a Script field with the following script:

    function Hash_Tag() {
    
    	var keyword = record.getFieldValue('fld-6ec7c1fdcc094a1c8d935b36158cb0a8');
    	var hashTag = "#" + keyword.split(' ').join('_');
    
    	return hashTag;
    }
    
    Hash_Tag();

    Replace the fld-... bit with the field ID from your own Keyword field.

    Attachments:
    You must be logged in to view attached files.
    #35035

    In reply to: Learning Javascript

    Brendan
    Keymaster

    Hi FourD,

    You can find out about what JavaScript is used in Tap Forms from this link:

    https://tc39.es/ecma262/

    But it’s more of a description of the language and not a tutorial.

    The Scripting topic in the manual and the API documentation should give you an idea how to go about things specifically in Tap Forms:

    https://www.tapforms.com/help-mac/5.3/en/topic/scripts

    You can basically use any JavaScript tutorials that are not specifically geared to programming a web browser. Or at least if you do, you can ignore the parts that refer to the DOM (document object model). Tap Forms uses JavaScript, but basically just for it’s syntax and functionality in the general sense. There is an API I added to it which gives you specific functions you can call that specifically work on your Tap Forms data.

    Here’s the API:

    https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api

    Thanks!

    Brendan

    #35034
    Sam Moffatt
    Participant

    The 0.02 number is your inflation rate, 2% in this case. Just change that constant to what ever you want it to be and refresh your record to get the updated value. If you tick the box for running only once it’ll stick. You could put an extra field in the form for the inflation rate you want to use for the record.

    With scripting you could do something a little more complicated and with some join fields you might be able to do something where you have a form with records per year and the interest rate you want to set.

Viewing 15 results - 2,476 through 2,490 (of 2,950 total)