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 - 16 through 30 (of 2,950 total)
  • Author
    Search Results
  • #53043
    Harry
    Participant

    Since a calculation field didn’t work, I used a script field instead and that worked.

    • This reply was modified 1 month ago by Harry.
    • This reply was modified 1 month ago by Harry.
    #53023

    In reply to: Pricing Model

    Brendan
    Keymaster

    Hi Steve,

    Thank you so much for your very kind words and feedback.

    There are certainly apps that I subscribe to myself that don’t provide their own back-end services. Such as Sketch, Tower Git Client, and Sleep Cycle to name just a few. I pay the subscription fees because they continue to improve and support their apps and I benefit from that. And to help support the continued development of their apps.

    What if I said “here’s an app for a one-time fee, but you can never ask me a question about it, I won’t provide a support forum, and I’ll never release new features, bug fixes, or improvements”. I’m sure not many people would like that. I wouldn’t like that.

    Even though it doesn’t seem like it for Tap Forms, there are ongoing costs for me to continue developing, supporting, and marketing it (and hosting my domains, email, and website).

    In my entire history of 17 years of Tap Forms development, I had only ever had one upgrade charge when I released Tap Forms 5. And customers were entitled to a 50% discount, as they are on the first year of Tap Forms Pro. That was pretty good value in my opinion.

    Also I haven’t removed Tap Forms 5 from the App Store, so you can certainly get that version for a one-time fee and I am happy to support you for as long as you own it.

    I realize subscriptions aren’t for everyone and you do have options with Tap Forms 5, or if you value my continued development of Tap Forms, then you could subscribe to Pro.

    I want to continue developing Tap Forms for as long as customers keep enjoying using it, and subscriptions allow me to continue to do that.

    Thanks,

    Brendan

    #53022

    In reply to: Newbie Questions

    Brendan
    Keymaster

    Oh, as for ChatGPT helping you to write scripts, I think some customers have had some success with it. It can hallucinate though. What are you attempting to accomplish with your script?

    #53015
    Glen Forister
    Participant

    I have a field (Date Type) = “Date Collected” containg a collection date (mo/day/yr. = 07-29-10
    .
    I want another field to take that date and supply the “Day of Year”.

    I’ve looked at the functions, etc., and can’t find a way to do this. The discussion about date indicate that the way it is created is not accurate and therefore they don’t give a solution. However, I don’t care if the result is not exactly accurate, but I need it to be simple and accurate to within a few days.
    Can this be done with a calculated field or does it have to be a script?
    If it has to be a script, can you please supply me with when that will work since I’m not able to do that.

    I want to then be able to sort all my data by the day of year so that I can see which insects are collected during whatever period in year.
    Thank you

    #53011

    In reply to: Pricing Model

    timzu
    Participant

    I don’t mind a subscription model that is reasonably priced if I know what features are being planned in the future. Right now there is no road map and Tap Forms Pro has been out for quite a few months now.
    I am definitely not upgrading until iOS layouts are added. I was waiting for those in Tap Forms 5. I know Brenden said he is working on them.

    #53008
    Shane
    Participant

    Thanks Branden, I am using the latest TFP update.

    Of note, in TF5 you cannot link the form to itself properly unless you use the JOIN relationship. TF5 will display its parent as a child if you use ONE TO MANY. JOIN works, but under a JOIN you cannot use a calculation field to pull record data from the parent record in order to cascade data along the children.

    TFPro can use ONE TO MANY and it works properly, but the calculation fields and scripts seem to work intermittently. I’m still trying to figure it out. It could be related to when scripts and calculation fields are executed. I’m assuming they’re executed when the record is viewed? If so then it can be problematic when viewing/ editing child records that depend on data properly being calculated via its parent.

    Another intermittent and BIG PROBLEM with TFPro is when you click a child record in a link to field object, it goes to the child record, but doesn’t show any of the fields (it’s blank) as if there are no fields in the form. You have to add a second child record then click back to the original child for it to work properly. Weird. When I have time I’ll send you a video of it.

    Related to forms linking to themselves, is there a way to use javascript to pull field data from a parent record? I have only been able to do this with a calculation field and have only seen child records in the javascript API. Javascript seems to only grab data from the field of the current record. So I have been trying to use a calculation field to pull the parent field data, and a script to manipulate it but right now.

    • This reply was modified 1 month, 1 week ago by Shane.
    • This reply was modified 1 month, 1 week ago by Shane.
    #53007

    Topic: Newbie Questions

    in forum Script Talk
    j albin
    Participant

    Newbie questions:
    Does the online pro version of the documentation apply?
    I exported a csv file of a table on the iPhone but can’t find where Tapforms puts them?
    Has anyone been successful in using ChatGPT to write TapForms scripts?

    Thanks much
    JASailor

    #53006
    Steve Cichosz
    Participant

    I am a bit confused by the pricing model for Tap Forms Pro. As I see pricing models, one time download apps like Tap Forms that are stand-alone programs untethered from third party service support would fall under a one-time purchase model. An app that requires ongoing back end service like iCloud, or regular data refresh services like, PictureThis or AccuWeather justify monthly or annual subscription. What are the daily support services requiring Tap forms to solicit service fees in support of back end overhead necessary to facilitate purchased end-client functionality?

    Tap Forms is truly one of the great pieces of software for Mac products and would be my pick for the Apple hall of fame if there were such a thing. All the same I would rather not pay every month in perpetuity for a stand-alone app I am dependent on and likely to use for a long time to come. That becomes extremely expensive for the average Joe that isn’t a business accustomed to signing ongoing service contracts with their stand-alone software.

    Steve

    #52987
    Harry
    Participant

    I’ve been testing the fix and I’m happy to report that it’s working.

    On my iPad, one thing that took a little time to test is when a script updates a date and that changes the sort order, it takes up to 5-7 seconds until the form syncs and then the sort order is updated correctly. At first I thought that wasn’t working, but a little patience proved otherwise.

    For me, everything is working fine now for all my forms.

    Daniel Leu
    Participant

    Your script is executed several times. That’s why you get the repeated prompter.

    1) You don’t want to trigger the script when changing the street field. To prevent this, use double quotes in var streetField = orderForm.getFieldNamed("Street");

    2) When setting a field value that should not trigger any script activity, use the optional third parameter: targetRecord.setFieldValue(targetStreetField.getId(), selectedStreet, false);

    Even with these changes, the script runs more than once.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    Daniel Leu
    Participant

    I noticed that you don’t use document.saveAllChanges() in order to save your modifications.

    I simplified the script to test the prompter function and it works as expected. Could you share a template file or even better a small document with a few sample records in order to reproduce the issue you see? Thanks!

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #52979
    Glen B
    Participant

    /**
    * This script is designed to be run from a button on the Order form layout.
    * The button should be configured to “Run Script Field Script”.
    */
    function findAndSetStreet() {
    // The ‘record’ object is automatically available when a script is
    // run from a button on a record’s layout.
    var currentRecord = record;
    var orderForm = form;
    if (!currentRecord) {
    Utils.alertWithMessage(‘Error’, ‘This script must be run from a record.’);
    return;
    }
    var companyForm = document.getFormNamed(‘Company’);
    if (!companyForm) {
    Utils.alertWithMessage(‘Script Error’, ‘Could not find the “Company” form.’);
    return;
    }
    // — CONFIGURATION —
    // On the line below, change “Company” to the EXACT name
    // of your company pick list field.
    var companyField = orderForm.getFieldNamed(‘Company’);
    // ———————
    var streetField = orderForm.getFieldNamed(‘Street’);
    if (!companyField || !streetField) {
    Utils.alertWithMessage(‘Script Error’, ‘Could not find your Company Pick List or Street fields.’);
    return;
    }
    var selectedCompanyName = currentRecord.getFieldValue(companyField.getId());
    if (!selectedCompanyName || selectedCompanyName === ”) {
    Utils.alertWithMessage(‘No Company’, ‘Please select a company before clicking this button.’);
    return;
    }
    var companyNameField = companyForm.getFieldNamed(‘Company Name’);
    var companyStreetField = companyForm.getFieldNamed(‘Company Street’);
    if (!companyNameField || !companyStreetField) {
    Utils.alertWithMessage(‘Script Error’, ‘Could not find “Company Name” or “Company Street” fields in the Company form.’);
    return;
    }
    var companyRecords = companyForm.fetchRecords();
    var matchingStreets = [];
    for (var i = 0; i < companyRecords.length; i++) {
    var companyRecord = companyRecords;
    var companyName = companyRecord.getFieldValue(companyNameField.getId());
    var street = companyRecord.getFieldValue(companyStreetField.getId());
    if (companyName === selectedCompanyName && street && street !== ”) {
    if (matchingStreets.indexOf(street) === -1) {
    matchingStreets.push(street);
    }
    }
    }
    if (matchingStreets.length === 0) {
    Utils.alertWithMessage(‘No Streets Found’, ‘No street addresses were found for ‘ + selectedCompanyName + ‘.’);
    currentRecord.setFieldValue(streetField.getId(), ”);
    return;
    }
    if (matchingStreets.length === 1) {
    currentRecord.setFieldValue(streetField.getId(), matchingStreets[0]);
    Utils.alertWithMessage(‘Street Set’, ‘The street address has been automatically set to: ‘ + matchingStreets[0]);
    return;
    }

    // Store references in variables that the callback can access
    var targetRecord = currentRecord;
    var targetStreetField = streetField;

    var prompterCallback = function(continued) {
    if (continued) {
    // Try to get the value using the global variable approach from your original code
    if (typeof selectedStreet !== ‘undefined’ && selectedStreet) {
    targetRecord.setFieldValue(targetStreetField.getId(), selectedStreet);
    }
    }
    };

    var prompter = Prompter.new();
    prompter.cancelButtonTitle = ‘Cancel’;
    prompter.continueButtonTitle = ‘Select’;
    prompter.addParameter(‘Select Street Address:’, ‘selectedStreet’, ‘popup’, matchingStreets);
    prompter.show(‘Multiple Streets Found for ‘ + selectedCompanyName, prompterCallback);
    }

    // Check if this is running in a Script Field context (automatic execution)
    // vs being called from a button (manual execution)
    if (typeof record !== ‘undefined’ && record) {
    var companyField = form.getFieldNamed(‘Company’);
    if (companyField) {
    var companyValue = record.getFieldValue(companyField.getId());
    // Only run if there’s actually a company selected
    if (companyValue && companyValue !== ”) {
    findAndSetStreet();
    }
    }
    }

    Glen B
    Participant

    It looks like the file did not attach so the code is below
    ============================================================

    /**
     * This script is designed to be run from a button on the Order form layout.
     * The button should be configured to "Run Script Field Script".
     */
    function findAndSetStreet() {
    	// The 'record' object is automatically available when a script is
    	// run from a button on a record's layout.
    	var currentRecord = record;
    	var orderForm = form;
    	if (!currentRecord) {
    		Utils.alertWithMessage('Error', 'This script must be run from a record.');
    		return;
    	}
    	var companyForm = document.getFormNamed('Company');
    	if (!companyForm) {
    		Utils.alertWithMessage('Script Error', 'Could not find the "Company" form.');
    		return;
    	}
    	// --- CONFIGURATION ---
    	// On the line below, change "Company" to the EXACT name
    	// of your company pick list field.
    	var companyField = orderForm.getFieldNamed('Company');
    	// ---------------------
    	var streetField = orderForm.getFieldNamed('Street');
    	if (!companyField || !streetField) {
    		Utils.alertWithMessage('Script Error', 'Could not find your Company Pick List or Street fields.');
    		return;
    	}
    	var selectedCompanyName = currentRecord.getFieldValue(companyField.getId());
    	if (!selectedCompanyName || selectedCompanyName === '') {
    		Utils.alertWithMessage('No Company', 'Please select a company before clicking this button.');
    		return;
    	}
    	var companyNameField = companyForm.getFieldNamed('Company Name');
    	var companyStreetField = companyForm.getFieldNamed('Company Street');
    	if (!companyNameField || !companyStreetField) {
    		Utils.alertWithMessage('Script Error', 'Could not find "Company Name" or "Company Street" fields in the Company form.');
    		return;
    	}
    	var companyRecords = companyForm.fetchRecords();
    	var matchingStreets = [];
    	for (var i = 0; i < companyRecords.length; i++) {
    		var companyRecord = companyRecords;
    		var companyName = companyRecord.getFieldValue(companyNameField.getId());
    		var street = companyRecord.getFieldValue(companyStreetField.getId());
    		if (companyName === selectedCompanyName && street && street !== '') {
    			if (matchingStreets.indexOf(street) === -1) {
    				matchingStreets.push(street);
    			}
    		}
    	}
    	if (matchingStreets.length === 0) {
    		Utils.alertWithMessage('No Streets Found', 'No street addresses were found for ' + selectedCompanyName + '.');
    		currentRecord.setFieldValue(streetField.getId(), '');
    		return;
    	}
    	if (matchingStreets.length === 1) {
    		currentRecord.setFieldValue(streetField.getId(), matchingStreets[0]);
    		Utils.alertWithMessage('Street Set', 'The street address has been automatically set to: ' + matchingStreets[0]);
    		return;
    	}
    	
    	// Store references in variables that the callback can access
    	var targetRecord = currentRecord;
    	var targetStreetField = streetField;
    	
    	var prompterCallback = function(continued) {
    		if (continued) {
    			// Try to get the value using the global variable approach from your original code
    			if (typeof selectedStreet !== 'undefined' && selectedStreet) {
    				targetRecord.setFieldValue(targetStreetField.getId(), selectedStreet);
    			}
    		}
    	};
    	
    	var prompter = Prompter.new();
    	prompter.cancelButtonTitle = 'Cancel';
    	prompter.continueButtonTitle = 'Select';
    	prompter.addParameter('Select Street Address:', 'selectedStreet', 'popup', matchingStreets);
    	prompter.show('Multiple Streets Found for ' + selectedCompanyName, prompterCallback);
    }
    
    // Check if this is running in a Script Field context (automatic execution)
    // vs being called from a button (manual execution)
    if (typeof record !== 'undefined' && record) {
    	var companyField = form.getFieldNamed('Company');
    	if (companyField) {
    		var companyValue = record.getFieldValue(companyField.getId());
    		// Only run if there's actually a company selected
    		if (companyValue && companyValue !== '') {
    			findAndSetStreet();
    		}
    	}
    }
    
    • This reply was modified 1 month, 2 weeks ago by Brendan.
    #52972
    Peter Riley
    Participant

    Wonderful! Thanks Daniel.

    I did some research into JS methods but have to admit the code was way above my level so, elegant or not(!), your solution is just what I need.

    I get a console error if the table is blank in a record (because that particular meal has been eaten and the row deleted) but that doesn’t seem to affect execution of the script.

    Cheers

    Peter

    #52968
    Peter Riley
    Participant

    My freezer inventory db (template attached) has a table field in which I record each time I make a batch of a particular recipe. The table field’s fields include things like the quantity of meals frozen, and the date frozen. I have a field script that correctly populates a Total field with the total remaining meals from each record’s table, and I have tried to do the same with a date field – ‘Earliest freeze date’ – to extract the oldest frozen meal from that recipe, using the following script so I can then include the field in a search:

    record.getMinOfLinkedFieldForField('fld-7b64bb627a8a4beaadacd625f3c4e46a', 'fld-557ef5d4175949a8a0ac0b7b3cf5f932');

    This is the total script – ie there is no function – but for a batch of meals frozen on 21 April 2025 and 14 September 2025 I get ’21 Jan 1970 at 05:46:30′ in the script field. The console shows the result of running the script as 1745190000. The Result Type is set to ‘Date’.

    Is getMinOfLinkedField not appropriate for a date calculation?

    I’m assuming it’s not possible to script a search through the freeze dates of the table field?

    Thanks

    Attachments:
    You must be logged in to view attached files.
Viewing 15 results - 16 through 30 (of 2,950 total)