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
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
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
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
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.
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.
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.
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
Hi Doug,
If you use the Radio Button option for Pick Lists, the value you select is what’s stored in the field. If you use the Checkbox Buttons option for the Pick List, then Tap Forms will generate a comma separated values list that’s stored in the field. So treat them as text in a Calculation field or Script.
So that label position setting used to work. I’m thinking that it might be a Big Sur issue. Are you using Big Sur? I may have to turn it off on Big Sur if that’s no longer supported as a feature in macOS.
Thanks,
Brendan
Hi Sam,
I would like to use your example for presenting a pop up list based on the selection from the first pick list but I am a complete novice and unsure where I should put the script – do I create script fields or do I create text fields using the pick lists and then put the script somewhere else?
kind regards
Mike
Hi Brendan, 5 years into using TF and I love it. I’m no guru however always building and developing Various TF databases for me and my family.
My query is..
I’ve got a main form that pulls data from another x7 child forms, I output the info in pdf via email. Is there a way I can have a basic TF control to manage a page break in the output.
I’m thinking a feature similar to a “section heading” function, so I can preset a number of fields above the page break etc. Please note I haven’t learnt scripting yet.
You thoughts would be welcome.
Cheers Anthony
Hi,
Is there a way to update only selected entries? For me, the menu entry is always gray, either in table view or list view (see screenshots).
If you select “Refresh record list”, Tap Forms recalculates all entries. This takes a particularly long time if you have many entries (with scripts and calculations). Especially when you are in a child form entry you only want to update the associated entries and not all of the forms in the background.
Is this a mistake or am I doing something wrong?
Thanks to all.
Chris
Attachments:
You must be
logged in to view attached files.
Yeah, I think I will eventually end up with one field or three, but for now it seems like I should go with two: 1 containing the exact dates I know and another for the fuzzy dates. I might eventually run one of Daniel’s scripts and just use the text, but for now it is just data and I feel like maybe I should accumulate a little more before I decide what is really best in the future.
If you need flexibility in representation, a text field is probably the best option. Having two fields would confuse things and I think you’d want to end up with three: one for precise dates with the picker, a text field for approximate dates and then a calc or script field for display that displayed the precise date or approximate date based on which value is set. On the Mac, a layout would help with display but for data entry you’d need both fields visible. You could potentially script it but at that point you’re losing the date picker UI functionality so you might as well just use a text field.
There are two problems with making this happen now: the first is that as far as I know the Tap Forms’ Siri integration doesn’t have a way of passing data into it to make that happen and the second is that the Siri Intent API is rather prescriptive on how phrases are defined by the application ahead of time without a run time ability to handle it dynamically.
What I’ve done before is using Siri Shortcuts and setup prompts within it and used the CouchDB integration to do Siri Shortcut based creation with prompts. It’s not the easier thing to build in the Siri Shortcuts interface, particularly on a phone, but it is a pathway that does work. It requires you to have access to that web infrastructure to answer the question though.