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,486 through 1,500 (of 2,989 total)
  • Author
    Search Results
  • #43529
    Chris Ju
    Participant

    Hi Brendan,

    did you ever thought about adding a feature with which one can map new fields (of an import file) to existing fields of the form?

    At the moment i run a script on a saved search to copy imported field values to target fields.

    Thanks
    Chris

    #43504
    John Eckenrode
    Participant

    Is there a script, or another way, to reposition a photo within the bounding box in a form layout?

    In other words, I have a layout for an art collection catalog.
    I have a square bounding box for the main photo on the layout page.
    I want to align the photos to the top of the bounding box.
    Tap Forms defaults to centering the photo within the bounding box.
    I want it to align to the top of the box.

    This a purely aesthetic change I’d like to execute–to make the layout nicer/cleaner/more consistent
    with differing art aspect ratios and orientations.
    Not a must have, but a “it would be nice” to have.

    Any ideas how to do this? Is this even possible?

    #43490
    Sam Moffatt
    Participant

    I think this with a bit of work could be interesting with the embedded aspect. I think the ability more generically to be able to render a point, or set of points, over an image is useful. I think that’d be interesting for layouts that are intended to be printed (custom or default) and would see that as a useful improvement for the current location field type as well where the base image is sourced from Maps (maybe have to use OSM data for legal reasons). I think it requires some thought to zoom and cropping considerations with the rendered images and point overlay but I could see a use for this feature. I think at least an improvement to be able to print a map for the current location field would be useful and then from there this feature isn’t too far away.

    One other thing I’ve wanted for a while is a polyline feature for overlaying a series of points on a map for mapping road trips. I’ve done the individual points as an import and overlaid that in the map mode but the point aggregation messes with making it a smooth line. In that case it’d be a single parent record and a series of child points (perhaps modelled like a table field with a map renderer and the option to connect points).

    The major aspect is the ability to compose a point over the top of an image which can be done for maps today but can’t be done with custom imagery. That just made me wonder about custom tilemaps for something like Minecraft map renders but that’s a much larger can of worms and definitely out of scope.

    It occurs to me that a while back someone was using a custom layout to do a similar sort of use case except with seating arrangements. I think that might have been Gregory where he used a base image and then overlaid fields to get a sort of seat map effect. One might be able to replicate something like that with this where each record represents a seat and you get a visual map of where that seat is. Taking that one step further if a version of the map view was used you could click to select records using a seating layout as a base to pan around. The next step could be to create a three form layout: seat, ticket and show. Seat is that original use case, ticket could be expanded to include a link to seat and perhaps a script field to automatically extract the seat location from the linked seat record into an equivalent field in the ticket and then a show allows filtering the tickets by show through another link so that you can display all of the seats sold for a show. One could conceive of using a similar sort of setup for a restaurant though it has a temporal aspect potentially as well (which would be another level of awesomeness, time window slider + map overlay to filter records).

    I already do something similar for the scripting where I have a set of “known” locations and use that to automatically populate a location field in a form using a field script. I type into the location field a known location name and it replaces the field with the fixed location.

    As an aside, I built a thing like this many moons ago for a library use case for mapping back where a book was in a library. When you found a book you were interested in, you could click a button and it’d show you were the book was in the library. In that situation I ended up precomposing images mapping to shelves however I would have killed for today when location services on mobile devices is much more accurate to do a really cool find the book experience.

    That ended up longer than I expected…

    #43480
    Daniel Leu
    Participant

    You are using Sam’s script as a field script, but I think you would want to use it as a form script.

    Then in your custom layout, you can create a button to run that script.

    And the field type for ‘Epiphytic cactus’ should be text.

    Cheers, Daniel

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

    #43478
    Mike Sturmey
    Participant

    Hi Sam,

    I have managed to get your script working (to some degree with next to zero Javascript knowledge) however I have got to a point that I am really stuck and wondering if you could assist – I have attached the form.
    The issues are:
    When I create a new record, the field is automatically populated with ‘[object Promise]’ – I would like it to be empty.
    The script seems to run multiple times (for the number of records in the DB) instead of just once.
    The script replaces all the values of all the records – not just the one I am editing.

    If you could assist it would be great
    cheers
    Mike

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

    So, I haven’t worked out how this would be done exactly in JavaScript, but in general what I would do is first insert the current date value into my array, then sort the array. Then find the index of the current date (in objective-c it would be something like NSInteger currentDateIndex = [array indexOfObject:currentDate]), then to get the before date, just index into the array with array[currentDateIndex - 1] and the after date array[currentDateIndex + 1]. Doing appropriate bounds checks first of course.

    #43451
    GLS
    Participant

    Hello,
    For an invoicing DB I created a layout in which I would like to add a field to select the client, which will populate the address, and potentially get all the items to be billed if there is something like “onChange” for the address field to trigger the script that imports what is to be billed.

    Hiding the “client” field in the print dialog does not remove the field from the printout.

    Thank you

    GLS

    #43440

    In reply to: image queries

    Daniel Leu
    Participant

    I have no idea regarding the different sized thumbnails. That’s something for Brendan to answer.

    Brendan already provided the entire script. The only change you need to make is updating the field id var attachments_field_id = 'fld-......';. Create a field of type script. Open the script, paste Brendan’s code, select the picture field on the left, click on ID and use the fld-xxx value in the script fragment. That’s it. It took me longer to write this than it will you to create it :)

    Cheers, Daniel

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

    #43438

    In reply to: image queries

    Gabrielle Stanley
    Participant

    Daniel, thanks for your reply. I’m grateful that you took the trouble.

    I feel that writing scripts for this one-off need is perhaps more effort than it is worth, it would probably take me longer than manually going through all the records. Once I have finished processing the migrated data I will not be entering a record without an image, so I would not use the script again. However it is good to know that this is an option if something like this comes up in the future for something that might need to be checked multiple times.

    The thumbnails issue is more of an ongoing problem, as I do not know why images sometimes have a full size thumbnail, and sometimes have a small one, and this could therefore recur, and i wouldn’t want to have to check and resize the image on every record I add – and it takes about 30 seconds per image which feels like a long time when you are just wanting to move on to the next one needing to be resized.

    Gabrielle

    #43434

    In reply to: image queries

    Daniel Leu
    Participant

    Have a look at https://www.tapforms.com/forums/topic/attachment-exists-script/#post-40640 for the check if there are images.

    Cheers, Daniel

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

    #43431
    Daniel Leu
    Participant

    Hi Victor

    The issue is in following line where you redefine a variable:
    var details_on_documents = details_on_documents[n];

    I changed it to var details_on_document = details_on_documents[n]; (note the removed ‘s’) and updated all references. Now the script seems to work.

    function Type_Of_Documents() {
    
    	var details_on_documents = record.getFieldValue('fld-a86e811ce12443ba957a85da4dfafafe');
    	
    	const type_of_document_id = 'fld-68a7edd5bdc3485fb910ce1e9101f4e0';
    	const no_id = 'fld-8531f5a64e994e7d9a4e66e066aabda8';
    	const country_id = 'fld-603914f15c8b49e8b2318cbee5a9f46f';
    		
    	var txt = [];
    	
    	for (var n=0; n < details_on_documents.length; n++){
    		var details_on_document = details_on_documents[n];
    		var type = details_on_document.getFieldValue(type_of_document_id);
    		var number = details_on_document.getFieldValue(no_id);
    		var country = details_on_document.getFieldValue(country_id);
    		
    		txt.push((n+1) + ". type of documents: " + type + ", number of copies: " + number + ", destination country: " + country);
    	
    	}
    	
    	return txt.join(" - ");
    }
    
    Type_Of_Documents();

    Cheers, Daniel

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

    #43429
    Victor Warner
    Participant

    At How to loop over records in table Daniel Leu provided a script so that it was possible to extract the contents of the table field into an another field through a script?

    I have tried to use the code another table.

    In the document attached there is a table field (called ‘Details on documents’) contains three records.

    Below it I have added a script field (‘Script for details on documents’) adapting the code provided by Daniel Leu.

    However, the code does not loop through the records in the table field but only deals with the first record, although I have properly used (I think) the code Daniel provided. In the script editor no error is shown when the script is run.

    The code is:

    function Type_Of_Documents() {
    
    	// Replace with your own code
    
    var details_on_documents = record.getFieldValue('fld-a86e811ce12443ba957a85da4dfafafe');
    
    const type_of_document_id = 'fld-68a7edd5bdc3485fb910ce1e9101f4e0';
    const no_id = 'fld-8531f5a64e994e7d9a4e66e066aabda8';
    const country_id = 'fld-603914f15c8b49e8b2318cbee5a9f46f';
    
    var txt = [];
    
    for (var n=0; n < details_on_documents.length; n++){
    var details_on_documents = details_on_documents[n];
    var type = details_on_documents.getFieldValue(type_of_document_id);
    var number = details_on_documents.getFieldValue(no_id);
    var country = details_on_documents.getFieldValue(country_id);
    
    txt.push((n+1) + ". type of document: " + type + ", number of copies: " + number + ", destnation country: " + country);
    
    }
    
    return txt.join(" - ");
    
    }
    
    Type_Of_Documents();
    

    Any help would gratefully be received.

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

    These are powered by form scripts that you run on demand and it will prompt the interface for you to select the correct values. It has to prompt for each level due to how that interface works (only get results when dialog is submitted) but is flexible.

    The source format of your pick list data should help define the pathway. If you have a few options, you could use the built in pick lists and create one for each of the levels. If you have a lot top level options or many layers then you might want to look into the third option.

    Sam Moffatt
    Participant

    You can’t do this via the built in forms but it is available via scripting. I think the tangible feature request is a taxonomy or tree selection field type though I note you’ve posted on the populate pick list field from another field value thread in the Script Talk forum.

    Mike Sturmey
    Participant

    Hi,

    I am building a plant database and want to be able to select the ‘Species’ from a Pick List and then subject to the selection e.g if Epiphyllum is selected, the next field (Genus) will automatically present the Pick List ‘Epiphyllum’ which contains the list of the Epiphyllum genus. Is this possible? I am not proficient in scripting so looking for the simplest solution possible,

    kind regards,
    Mike

Viewing 15 results - 1,486 through 1,500 (of 2,989 total)