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,801 through 1,815 (of 2,952 total)
  • Author
    Search Results
  • #41218
    pierrot_rennes
    Participant

    Hi,
    I would like to be able to fill in a second field automatically based on the entry in another field.
    Is it possible in Tap Forms?
    Should we go through a script?
    For example, in field A, I enter a brand
    Field B automatically inquires with the corresponding country
    Thank you for your help

    #41210
    Victor Warner
    Participant

    Two issues:

    First issue: Finding the error in the script

    I am having an issue with the following script:

    var address_field_id = 'fld-1f639ae503fe419b8473b02ea17d4ac4';
    var address_field = record.getFieldValue('fld-1f639ae503fe419b8473b02ea17d4ac4');
    
    result = '';
    
    if (address_field=="newly identified - work address") {
    
    	result = record.getFieldValue('fld-943ab25fd0de42e7b8d1e5487c6a358b');
    	
    
    } else if (address_field=="already identified - work address") {
    
    	
    	result = record.getFieldValue('fld-11915a3f275a4938949714a664dc40bf');
     
     } else (address_field=="newly identified - personal address") {
    
    	
    	result = record.getFieldValue('fld-0e624f31b7af41b18fcb0262a7ec2a0d');
    
     }
    
    result;

    I am getting an error message in the script editor:

    Address chooser: SyntaxError: Unexpected token ‘{‘. Parse error., line:13

    Line 18 being the final else statement (“} else (address_field==”newly identified – personal address”) {“).

    I cannot see the error, although I am sure it is a typo on my part.

    Using a pick list as a basis to use data from other fields

    The aim of the above script is as follows:

    1. I field has a pick list
    2. The script field (using the code) will test which of the items in the pick list have been chosen and then get the value of another field in the database.

    The complete database is attached (although a simplified version of what I want to do).

    Is the script (as done or as corrected) the best way of this?

    Any help with this would be gratefully received.

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

    In reply to: Generate a photo sheet

    pierrot_rennes
    Participant

    Hi Brendan,

    Thank you for your answer

    I understood well for the labels mode and the layout.
    This is precisely why I asked the question ;-))
    Couldn’t it be an improvement of the software to integrate the possibility of creating photo boards in full page?
    several photo software allow you to make hot plates without using label format pages.

    All of our databases contain photos.
    It might be useful to be able to produce photo plates with a title field at least under each
    This would also allow you to have headers and footers, titles …

    Regarding color, I saw this possibility.
    But that’s not what I want ;-))
    It is related to the script concerning the coloring of a recording line.
    In my collections, I check the field if I have the object in collection and it works well thanks to your help and that of Sam
    So I would like that for the photo board mode, a field will be colored under the photo if this recording is checked in the collection.
    It may be complicated or impossible but I ask the question ;-))

    Thanks in any case for the responsiveness

    #41171
    Brendan
    Keymaster

    I think I missed the second part. But the script value did get updated after deleting a photo with my fix on the record details view though.

    #41151
    Brendan
    Keymaster

    Great video Sam! And as you may have seen in my comment on your Youtube video, I’ve fixed the bug with the script not running when you delete a photo.

    #41143
    Sam Moffatt
    Participant

    Another workaround for the list, create a new script field (I called mine “Empty Image Field”), open it up and it’ll drop in a bit of template code for you. If you double click on the image field in your field list on the left, it’ll insert the field ID for the image field. Then if you make the script look something like this, you’ll have a searchable field on if the image field is empty (image_01 is the name of my image field, it’ll like be var cover = ... for you):

    function Empty_Image_Field() {
    	var image_01 = record.getFieldValue('fld-e631165b67374734a3b8f384708b5922');
    	return image_01.length;
    
    }
    
    Empty_Image_Field();
    

    Set it to be a “number” field on the bottom left (default is text) and also tick “update records when saving” to run the script on all of your records. Then hit “Save”, it’ll take a moment for TF to update all of your existing records with the new value for the field (that’ll depend on how many records you have) and then you should be able to look for records that have zero images using the script field and looking for a value of 0.

    #41088
    Sam Moffatt
    Participant

    Thanks! I need to work on the audio quality, too many computer fans and background noise (need to close some more windows). I played with the screen recording tool I used a bit and found some noise cleanup options. Probably should script things better but I figured I’d put my money where my mouth was after suggesting doing video tutorials a while back.

    #41058
    Daniel Leu
    Participant

    TapForms comes with example forms for driver licenses and passports. The driver license form might be good starting point. Add a photo field, change class to license type, remove the sex and date-of-birth field. Maybe add a description field where you can note some license specific infos.

    Cheers, Daniel

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

    #41053
    Rocky Machado
    Participant

    Hi – In the Import Records Dialog, when I select a file and the field names appear in the Assign field types section. I notice that I can edit the Field Name. What is the intention? I was hoping I could define a mapping to a form. For Example, a field called description in the file. I might want to map it to a field type called comments in an existing form.

    thanks,
    rocky

    #40977

    In reply to: Driving Me Nuts

    Sam Moffatt
    Participant

    I certainly saw a bunch of weird issues with TF5 and Nearby sync but the performance was much better than iCloud and I didn’t want to pay IBM. Most of them went away when I did a star topology with my iMac but every so often I made a triangle which fixed some sync issues. I shifted to CouchDB support when it was added and since then I haven’t run into many more weird issues. I have had one instance where bringing an old device online caused a script field to be overwritten (I think Brendan improved the sync code to fix this at some point too) but that’s the only issue I’ve noticed. In at least the last year that I can recall I haven’t had an issue.

    I certainly recommend getting CouchDB setup, I ran mine on an old iMac 2011 for the longest time before finally moving it to a dedicated Linux box I bought a couple of years back.

    However because there can be issues, this is also why I have multiple backup solutions for Tap Forms on my GitHub. I do this on top of routine backups of the Tap Forms document on my Mac as well. It doesn’t matter what scale you’re at, having backups should be a part of your technology solution. Sync is not a backup solution and I’m yet to meet a perfect solution when you have a split brain. Tap Forms does a reasonable job in my opinion and I’ve not had too many issues.

    The central CouchDB server (or Cloudant if you wanted) provides a bidirectional sync from a central spoke. This means your device proactively reaches out to to the server to push changes that are made locally and when the server receives updates it proactively pushes the change to your device (if Tap Forms is open) otherwise you pull them down next time you connect to the server. The Nearby sync is only ever on a pull model which can make it hard to force consistent state across all devices as replication state is at the document level. Because it’s a pull model as well also means that there isn’t anything that proactively gets the changes off your device, it’s up to the puller to pull down the changes.

    tl;dr dedicated CouchDB is great for reliability, you can install it on your Mac and get it working on your home network

    #40953
    Sam Moffatt
    Participant

    Yeah, use a single script with all of the logic in it, you can pull in as many fields as you like and they’ll all trigger the script. You can then pass it through which ever conditionals you want in the Javascript code to set the row colour.

    I would advise against having multiple script fields for setting the row colour because then the logic for the row colour is in two places and debugging that is a nightmare to fix :)

    #40950
    pierrot_rennes
    Participant

    Hi Sam,

    It’s done, thanks a lot !!!
    If I want to color certain lines in relation to two fields to check, I can put everything in the same script I think?
    (with different colors of course ;-))

    #40946
    Daniel Leu
    Participant

    If you want to have checkboxes, following script sets a checkbox based on the ‘yes/no’ field:

    function Yes_No_Script() {
    
    	const check_mark_id = 'fld-xxx';
    	const yes_no_id = 'fld-xxx';
    
    	if (record.getFieldValue(yes_no_id) == 'Yes'){
    		record.setFieldValue(check_mark_id, 1);
    	} else {
    		record.setFieldValue(check_mark_id, 0);
    	}
    	form.saveAllChanges();
    }
    
    Yes_No_Script();

    This is a field script. If you change the checkbox value, it is overwritten by this script. That’s something that could be changed, but I wanted to keep it simple to start with.

    The only thing you need to change are the two ids.

    Cheers, Daniel

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

    #40944
    Kimberley Hoffman
    Participant

    I am trying to avoid replacements, so I don’t accidently erase data. Some of the fields are GDPR fields and they need to be kept. And truthfully, I have no idea on how to write a script.

    But maybe just changing the fields to text fields would be the easiest?

    #40942

    In reply to: Watched TV Shows

    Daniel Leu
    Participant

    I would copy the https://www.omdbapi.com/?i=tt0185906&apikey=???&type=series&r=json string into your browser and see if there is an episode 1. If there is, then there is an issue with the script, if there isn’t, then it is coming from ombpapi.com.

    Cheers, Daniel

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

Viewing 15 results - 1,801 through 1,815 (of 2,952 total)