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 - 1,756 through 1,770 (of 2,952 total)
  • Author
    Search Results
  • #41470

    In reply to: Design Feedback

    T.L. Ford
    Participant

    A simple field type of “button” that ran a script (like the Script field type) would work wonders for this (and other uses). The multi-column grid view could show the button with its text label on it.

    My current play looks like the attached. I put the button on a different layout and put that layout on the bottom split of the view.

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

    Hi Rocky,

    This is supported, but you need to get the Script object first.

    Try this:

    var script = form.getScriptNamed("My Script");
    var scriptName = script.name;
    console.log(scriptName);

    See if that works for you.

    But also, there is a built-in variable called scriptName that you could simply access to get the name of the currently executing script.

    So just try:

    console.log(scriptName);

    #41454
    Rocky Machado
    Participant

    Hi Brendan – I know I can hit the refresh button to recalculate all my formulas on a form or have my transaction appear in a search. Is it possible that you could expose the recacluate feature in the Javascript API. The reason I am asking is that about 95% of my data entry is done thru data uploades and it would be nice to execute the recalculate feature in the code. So that I don’t need to remember to hit the recalculate button all the time.

    thanks,
    rocky

    #41453
    Rocky Machado
    Participant

    Hi Team – trying to use the following snippet of code to get the script name var scriptName = script.name; but I keep geting message “Can’t find Variable: script” Is the script API no longer supported?

    thanks,
    rocky

    #41448

    In reply to: Logger Module

    Sam Moffatt
    Participant

    I must have missed escaping the backticks when I originally posted it, the forum catches them and turns them into the code tags even though it’s inside a code environment already. @daniel_leu is correct though, my scripts are all up on GitHub so you can grab them there.

    #41446

    In reply to: Logger Module

    Daniel Leu
    Participant

    I would download the latest version of the script from Sam’s github repository: https://raw.githubusercontent.com/pasamio/tftools/master/scripts/js/logger.js

    Cheers, Daniel

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

    #41439

    In reply to: Logger Module

    Rocky Machado
    Participant

    Hi Sam – Reallly like your Looger module. I’m getting an error when trying to compile it. It seems it does not like the “code” tag. Am I missing someting? or did the “code” tag get placed when you copied the script to the site? Also, Have you mofified the script since this last post? If so, can you attach the script?

    it failing here.

    this.logMessage( <code>Caught error: &quot;${error}&quot; at ${error.line}, ${error.column} </code>);

    thanks,
    rocky

    #41424
    Victor Warner
    Participant

    Brendan,

    Thank you very much for adding the following:

    Added list of form layouts to the Layout menu. Changes dynamically depending on selected form.

    I hope you can continue to improve this so that it will be possible to be more easily change the order of layouts (in a similar way to Forms) which is currently not possible and also introduce a categories feature (in a similar way too to Forms).

    There are two specific queries on the update:

    Added new Markdown field type. This is a “note” type field where you can type in markdown and Tap Forms will render it for you.

    Is the flavour of Markdown you are using the most basic kind? That is not MultiMarkdown or any variant (such as supporting tables)?

    Added script functions to let you get and select custom layouts.

    Could you provide the syntax for these new script functions as they do not appear present on this page https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api.

    #41419

    In reply to: Script for Printing

    T.L. Ford
    Participant

    The for loop changes to add the time:

    	// loop through the songs records	
    	for (var index = 0, count = songs.length; index < count; index++){
    
    		// get the Song Title from the current record
         	var song_title = songs[index].getFieldValue(song_title_id);
         	
         	// get the song time from the current record
    		var song_time = songs[index].getFieldValue(time_id);
    
    		// if a song title exists
    		if (song_title) {
    
    			// if we have a time, go ahead and add it to the song_title string
    			if (song_time) {
    				// shorthand for  song_title = song_title + ", " + song_time
    				song_title += ", " + song_time;
    			}
    
    			// add the song title to the array
    			song_titles.push(song_title);
    			
    		}
    	}

    The javascript term is “string concatenation” – fancy for “adding two strings together” (strings are javascript’s way of saying text). While I’m at it… an “array” is javascript for “a list of something”.

    #41417

    In reply to: Script for Printing

    Victor Warner
    Participant

    T,

    Thank you very much for providing the example – it helped me understand where I was going wrong in implementing Brendan’s example (failure to pick up the difference between Song Title (the form) and Song Titles (the field name)) – without reference to the database I did not appreciate the difference.

    I cannot say I understand some of the code but I should be able to implement it at least.

    One query on an addition. If I wished to display a second field in the resulting script, how would I do this?

    For example, if I added a time field (as a text field) and then instead of display, e.g.

    Barry Went Out
    Bee Bounce
    Party On

    but instead

    Barry Went Out, 1:30
    Bee Bounce, 2:30
    Party On, 1:30

    I understand how to get the id of the time field into the script (and how to write the code to format shown immediately above, just not how to get into this part of the script:

    	// create an array to store the songs in
    	var song_titles = [];
    
    	// loop through the songs records	
    	for (var index = 0, count = songs.length; index < count; index++){
    
    		// get the Song Title from the current record
         	var song_title = songs[index].getFieldValue(song_title_id);
    
    		// if a song title exists
    		if (song_title) {
    
    			// add the song title to the array
    			song_titles.push(song_title);
    

    Help with this part would be greatly appreciated. I attached the datebase with the added field.

    Attachments:
    You must be logged in to view attached files.
    #41408
    Sam Moffatt
    Participant

    If you have script, why not just have it add new entries to a table in the other form?

    #41406

    In reply to: Script for Printing

    Brendan
    Keymaster

    T.L. I don’t mind one bit! I love it when customers help each other and it’s exciting for me to see what new things people want to use Tap Forms for. The scripting engine has been especially great because it opens up a whole world of possibilities for different ways to use Tap Forms.

    #41401

    In reply to: Script for Printing

    T.L. Ford
    Participant

    Victor,

    This looks like this. I modified Brendan’s code to add comments explaining each line of the Javascript. Working example attached.

    Brendan – hope you don’t mind me adding things. I’m happily enjoying exploring your Tap Forms application and am learning new and better ways to do things.

    – T

    Edit: Technically it’s not the id of the song form, but the “link to form” field on the Genre form.

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

    In reply to: Script for Printing

    Victor Warner
    Participant

    Sorry to highjack this thread, but it would be very helpful for beginners (such as myself) to have a worked example.

    Would it be possible to provide a simple database showing an example of how this works, as I tried to follow the original’s posters requirement and adding a script field wit the code but I just get errors.

    #41384
    David Oxtoby
    Participant

    Cheers for that Sam, what i ended up trying and seemed to work for what i needed, was create a script field that reads all the entries in my table and create a formatted text return value (not shown on the booking form), and then in the linked invoice form, i have another script field that pulls from the linked form that new formatted return value and shows that instead.

    A bit of a faff inserting tabs and padding to to get the formatting looking ok, but works for what i needed.

    see screen shots for idea of what it looks like… The Venue Booking shows the rooms being hired, that has been output into a hidden field, which the Invoice breakdown then shows in another scripted field.

    Attachments:
    You must be logged in to view attached files.
Viewing 15 results - 1,756 through 1,770 (of 2,952 total)