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,056 through 2,070 (of 2,989 total)
  • Author
    Search Results
  • Max Heart
    Participant

    Hi everyone,

    I am trying again to find help. The first round, including some good advise was here:

    Inventory barcode scanning – assign box/ placement


    Unfortunately, I did not manage to create a workflow as I am not familiar with scripting.

    Here’s my goal and setting:
    I want to create a home inventory which helps me finding my stuff quickly. I have two forms: one for boxes and one for the items. From the boxes form I created a one to many link as one box contains many items but one item can only be in one box at a time. Each box has a QR code, each item has a bar code.
    I managed to create my forms and the relationship and search is working. The barcode search will find items and boxes.

    Here comes the challenges:
    1) Batch entry of items using barcode
    Can I pull up a box by scanning its barcode and then start a batch scan barcodes of items as I place them in the box?
    2) Batch checkout of items
    Let’s say I pack for a trip and remove a lot of stuff from different boxes. I guess, in the boxes form I should create a box called “Checked Out”. Is it possible to first search for an item, have the box displayed where it is and then move this item to “Checked Out”?

    I use my iPhone for scanning but in case this workflow only works with a dedicated barcode scanner on the desktop version, I would be happy to buy one. I am just kind of lost and couldn’t find a tutorial.

    Thank you for your help, Max

    #39632
    JBW
    Participant

    Hey there. I’m trying to move from airtable to tap forms.

    I can (and have) downloaded the tables from airtable to csv files. I can import these csv files as forms into tap forms. However, I cannot seem to link certain fields to other forms during the import. After I’ve toyed around a bit, I think I understand why I couldn’t do that. But maybe I’m missing something.

    So I tried to build a script that would take an existing text field, and move it over to an already “linked to” form. But I’m not a script writer.

    I need some help.

    I have a form called “classes” with a field called “players” that has comma delimited names in it as text. I would like to have a script that goes to each “players” field, grab each name, and add them to the “linked to” field called “players-linked”.

    I have another form called “players” that has each individual as a record (first name, last name, etc.).

    I can code a little, but I don’t understand how to handle the loops, or selections in tap forms. I need to do this script to a handful of other fields as well. If I can get one to work, I feel confident I can modify it to make the others work. Any ideas?

    #39616
    Sam Moffatt
    Participant

    Try revenue_total.toFixed(2); as your last line and see if that gives you the desired effect.

    As a lateral answer, you can configure the script field with a particular format. If you reconfigure your script field to use a “Number” return type, you can then use the number formatting options in the field configuration to have it display the way you want.

    #39611
    Bernhard
    Participant

    @Sam: Sounds good – thanks for the advice!
    For the record, here is how it works:

    
    var customerRecordIds = [];
    
    // Callback function of the Prompter call.
    function chooseCustomerCallback() {
    	createInvoice(customerRecordIds[choosenTitle]);
    }
    
    // Do something with the record after the user choose one.
    function createInvoice(recordId) {
    	var customerRecord = form.getRecordWithId(recordId);	
    	...
    }
    
    // The entry function of the script
    function Erstelle_Rechnung() {	
    	var titleFieldId = 'fld-aa817f3bd885458883d3e25802fd4037';
     	var customersForm = document.getFormNamed('Kunden');
     	var customers = customersForm.getRecords();
    	var companyTitles = [];
    	
    	for (var index = 0, count = customers.length; index < count; index++) {
    		const title = customers[index].getFieldValue(titleFieldId);
    		companyTitles.push(title);
    		// Remember the Record ID of this customer record to be used later.
    		customerRecordIds[title] = customers[index].getId();
    	}
    
    	var choosenTitle;
    
    	let prompter = Prompter.new();
    	prompter.addParameter('Kunde', 'choosenTitle', 'popup', companyTitles)
    		.show('Message prompt', chooseCustomerCallback);
    
    	return null;
    }
    
    Erstelle_Rechnung();
    
    #39609
    Bernhard
    Participant

    Sounds good – thanks for the advice!
    For the record, here is how it works:

    
    var customerRecordIds = [];
    
    // Callback function of the Prompter call.
    function chooseCustomerCallback() {
    	createInvoice(customerRecordIds[choosenTitle]);
    }
    
    // Do something with the record after the user choose one.
    function createInvoice(recordId) {
    	var customerRecord = form.getRecordWithId(recordId);	
    	...
    }
    
    // The entry function of the script
    function Erstelle_Rechnung() {	
    	var titleFieldId = 'fld-aa817f3bd885458883d3e25802fd4037';
     	var customersForm = document.getFormNamed('Kunden');
     	var customers = customersForm.getRecords();
    	var companyTitles = [];
    	
    	for (var index = 0, count = customers.length; index < count; index++) {
    		const title = customers[index].getFieldValue(titleFieldId);
    		companyTitles.push(title);
    		// Remember the Record ID of this customer record to be used later.
    		customerRecordIds[title] = customers[index].getId();
    	}
    
    	var choosenTitle;
    
    	let prompter = Prompter.new();
    	prompter.addParameter('Kunde', 'choosenTitle', 'popup', companyTitles)
    		.show('Message prompt', chooseCustomerCallback);
    
    	return null;
    }
    
    Erstelle_Rechnung();
    
    #39608
    Barry Shevlin
    Participant

    I’m almost embarrassed to ask this given it’s probably such a basic question. However, I could well use the following script given as an example in the TF5 manual:

    var records = form.getRecords();
    var revenue_total = 0;

    for (var index = 0, count = records.length; index < count; index++){
    var theRec = records[index];
    var movie_revenue = theRec.getFieldValue(‘fld-987c9aac738a4f0fa1d18395902b3fc1’);
    if (movie_revenue) {
    revenue_total += movie_revenue;
    console.log(‘Revenue: ‘ + movie_revenue);
    }
    }

    revenue_total;

    My question is this: how do I limit the revenue_total return to 2 decimal places (currency)? I am getting this sort of thing: £63.9300000000001.

    Sorry if this time-wasting but I’m sure there’s a quick answer that would save me hours of fruitless futzing. Thanks.

    #39594
    Bernhard
    Participant

    Hi all,

    as Javascript/Typescript programmer I’m used to the comfort of IDE’s like Visual Studio Code.
    I would like to edit Tap Forms scripts in my preferred editing application. In the _Edit form script_ window I could imagine a button like _Edit in external editor_ which opens the script in a configured editor application and automatically syncs changes back from the editor to the Tap Forms window.

    What do you think?

    #39592
    Larry Stoter
    Participant

    Do functions like getMinOfField(date_id) work with date fields? I suspect not …

    I have a form with a number of records and a date field. The dates in the date field are not necessarily in order of entry. I want to find the earliest date in in the date field. The following script reurns O ….

    var date_id = 'fld-1482677011584a9da584a27e8835f5a4';
    var FirstDate = form.getMinOfField(date_id);
    Utils.alertWithMessage('FirstDate','First date is ' + FirstDate);

    Suggestions for finding the earliest date?

    #39570
    Sam Moffatt
    Participant

    Most of the web based Javascript tutorials will be correct for Apple’s JavaScriptCore that Tap Forms utilises. There are some special objects in browsers like console, window and document that aren’t relevant to JSC and there are some functions not in the ECMA standard that are commonly available in browsers.

    On that note, the w3school’s JS Reference page on arrays should give you a better introduction to arrays though you might find some items don’t quite work. Core elements of the language like arrays should be fine.

    You might want to check out something like Javascript The Good Bits or other books on getting started with Javascript as well to learn this unique and peculiar languages quirks.

    #39567
    Sam Moffatt
    Participant

    In the records list screen for a form that has calculations/scripts, if you pull down like you’re trying to scroll past the top and if you pull it/hold it long enough it should popup with a message at the top of the screen saying “recalculating” or similar.

    #39566
    Wonnie Bad
    Participant

    Hi Tonyt,

    It’s a general question. In reply #33263 Brendan says

    Pull to refresh on the records list screen is your friend :)

    I would like to make a script that gets my records with to-do date in the future and if the date is tomorrow it moves it to a to-do-tomorrow list.

    I searched for a pull-to-refresh sign on iphone Tapforms form record list, but couldn’t find it..

    Thanks for trying!

    #39563
    Victor Warner
    Participant

    Brendan,

    Thank you.

    Is there a place where this type of syntax is explained or summarised.

    At https://www.tapforms.com/help-mac/5.3/en/topic/scripts you mention https://tc39.github.io/ecma262/, but a search ‘length’ produces page after page of entries, none of which seem particularly helpful/digestible for a person who knows nothing about JavaScript.

    #39552
    Victor Warner
    Participant

    Brendon provided some sample JavaScript to enable me to use the first record from a linked form:

    if (passportRecords.length >0) {
    
    var firstPassportRecord = passportRecords[0];
    
    var passport_number_id = 'fld-9fe227057cdf44bfa62ad8a97cc6a62a';
    var nationality_id = 'fld-0039b290b2054881ac8f004c01903c6f';
    var country_id = 'fld-6e861fab76b9457bb625953cece54c96';
    var date_of_issue_id = 'fld-0154d8f9ce384e708502fdd775d7bfb1';
    var date_of_expiry_as_text_id = 'fld-b76a031084a94d7e8927ad347e10e24b';
    
    var number = firstPassportRecord.getFieldValue(passport_number_id);
    var nationality = firstPassportRecord.getFieldValue(nationality_id);
    var country = firstPassportRecord.getFieldValue(country_id);
    var IssueDate = firstPassportRecord.getFieldValue(date_of_issue_id);
    var ExpiryDate = firstPassportRecord.getFieldValue(date_of_expiry_as_text_id);
    
    result = "date of birth " + record.getFieldValue(date_of_birth_as_text_id) + ", residing at " + record.getFieldValue(address_full_id) + "\r\r" + "Identified by " + record.getFieldValue(gender_id) + " statement and production of current " + country + " passport, passport number " + number + ", expiring on " + ExpiryDate + ", " + nationality + " Citizen"
    
    }

    I now would like to know how to obtain the last record from the linked Form. I can see how if I wanted the second record or the third record.

    But The issue is that I do not know how many records there are in the linked Form. In some instances there will be only 1 in other 2, 3 or more.

    Is there a command to look for the last record alone or another way to find out the last record and use it?

    Any help would be gratefully received.

    #39545
    Brendan
    Keymaster

    Hello TJ,

    I moved this post to the Using Tap Forms forum because I think it’s better placed there. The Template Exchange is mostly for posting your templates that you want to share with others.

    Tap Forms does have an Auto-Complete function built-in to it. You just have to click on a checkmark button to turn it on for your Text fields. Then Tap Forms will keep track of the previously entered values for that field and will provide a popup menu of those values.

    Also, Tap Forms has Pick Lists, which are pre-defined lists of values that you can setup and then choose from as you enter data into your fields.

    For your calculations, you can definitely do that.

    However, you would probably need a couple of fields to store the subscription costs based on whether they’re annual fees or monthly fees. Because Tap Forms wouldn’t be able to detect if you typed in “$2/month” or “$24/year”. So having a couple of different fields would handle that for you. For example you would maybe have a Monthly Fee number field and an Annual Fee number field.

    Then you could have a couple of Calculation fields to do the calculation for you.

    For Monthly Fee the formula would be:

    Monthly Fee * 12

    And for the Annual Fee, the formula would obviously be:

    Yearly Fee / 12

    And Tap Forms can also do grand totals for you and display the results at the bottom of the records list view.

    With Saved Searches you can create sub-lists of your subscription records based on different years.

    Hope that answers your questions ok.

    Thanks!

    Brendan

    #39540
    TJ Luoma
    Participant

    Hello all. I have never used Tap Forms before, but I bought a license awhile ago and would like to finally start using it.

    The first thing that I’d like to do is come up with a database that will allow me to track subscriptions.

    These fields would be required:

    + What is it for?
    + How much is it for?
    + How many months is the subscription for?
    + What date is it due to renew?

    These fields would be optional:

    – Which email address did I use to register? ¹
    – What payment source does it use? ¹
    – URL to go to for support
    – Email for support
    – What’s the URL to manage/change my subscription?
    – Other Notes

    For the fields marked with a ¹ that means that I would like the DB to remember previously-entered answers and offer them as auto-complete options (if that’s even a thing that is possible) _OR_ I would like to be able to define about 3-5 options and choose them from a dropdown or something

    Finally, the whole purpose of compiling this information is to see how much that I am paying per month/year for subscriptions, so I would like to be able to calculate how much I’m spending per year on a each subscription (i.e. if I put in that it’s $3/month then it should put $36 as the annual fee, but if I put that it’s $24/year then it ought to figure out that I’m paying $2/month, etc) _AND_ then I want to be able to get the numbers from _ALL_ of the subscriptions and show me the monthly / annual total.

    I have no idea if this is even possible, but I figured this was a good project to start with, since it is something I am actually interested in, and it seemed like a good fit for a database program.

    Thanks for any advice / pointers … on the off-chance that someone has already invented this wheel (or something like it) please pass it on!

Viewing 15 results - 2,056 through 2,070 (of 2,989 total)