There are many typos in your script. Please copy it from https://www.dropbox.com/scl/fi/kxvy7lpsepka5atnd8ymk/picklist_value.txt?rlkey=idzgqadkaba4co05o2x49h87i&dl=0. I already added your field id. So it should run just like this.
Oh, don’t forget to set the return type to number.
I run the script in one of my forms to verify that it works.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Tahnks Daniel.
I tried it and got an error off the bat. What I learned of scripting a year or so ago I’ve forgotten.
======= I typed the following and got this comment.
3/16/26, 4:14:05 PM / !Poop / Condition+
Condition+: SyntaxError: Unexpected identifier ‘Picklist_Value’, line:1
=================
Function Picklist_Value(){
const pickllist_id=’fld-3bf9d801a4334f17815a4e131c3fa83c”;
const picklist=recordxgetFieldValue(picklist_id);
//check that picklist has a value
if (picklist){
//split picklist value and use first element
const number=String(picklist)xsplit(‘;’)[0];
//return Number
return Number(NUMBER);
}
}
==========
So, Q1 – Is that Picklist a reserved word and we can’t use it?
and Q2 – Is the field id # that have there supposed to be another field? I dont think so, I used the field # associated with the field this script is written into (is that correct?).
I guess this will take a while. Thanks.
Hi Glen,
You could use a picklist format like ‘1: Red’, ‘2: Blue’, ‘3: Green’ and then add a field script to extract the value before the column:
function Picklist_Value() {
const picklist_id = 'fld-xxx';
const picklist = record.getFieldValue(picklist_id);
// check that picklist has a value
if (picklist) {
// split picklist value and use first element
const number = String(picklist).split(':')[0];
// return number
return Number(number);
}
}
Picklist_Value();
This script returns a ‘Number’ so you have to set the return type accordingly.
Now you can create your graph using the return value of this script and don’t need to remember the values when using the picklist.
Hope this helps!
-
This reply was modified 1 month, 4 weeks ago by
Daniel Leu.
-
This reply was modified 1 month, 4 weeks ago by
Daniel Leu.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
I need a field that is a number that can be used in a graph against time.
To fill that field I would like it to be a quick pick list. That is easy.
The number represents certain conditions which I don’t always remember.
The only way to do this is with a text box describing each number that shows up in the pick list.
Is there a more elagent way to do this within the pick list instead of having those descriptions on the face of the form?
I’m not sure it’s the latest 1.1 update or the fact that I just restored from a backup. But this script used to create new record in another form and link it and display it immediately in the record. Now I have to go out of the record into the other form and then back for it to show up. Is it my script or has something changed in Tap Forms Pro?
function CopyToEbaySales() {
// --- 1. CONFIGURATION ---
// A. Source Fields (From COINS Form) - HARDCODED IDs
var coin_type_id = 'fld-1231556e0f234de9b2d85f50225b8135';
var year_id = 'fld-4b84b047badd4d4cbb4a67ef6839522f';
var mint_id = 'fld-adb0be16f1a347dbbecc4ef562d779a7';
var photo_id = 'fld-d32730d871864ab2904cb60c587b105a';
var purchase_price_id ='fld-6deb90149d2b494fa3a3e89236398857';
// B. Destination Fields (From EBAY SALES Form) - HARDCODED IDs
var ebay_coin_type_id = 'fld-9fdddd3a7a47410394042488e730f6c0';
var ebay_year_id = 'fld-6bee0d6f1e2b413192715c2c807d526f';
var ebay_mint_id = 'fld-cc42485d28c14c99bbd4970619bee9cf';
var ebay_photo_id = 'fld-e4a157a02f4841dc845b3ce800565c8e';
var ebay_cost_id = 'fld-dfa5d5683deb466e9a8088d2d4db56a5';
// C. Link Field (From COINS Form) - DYNAMIC LOOKUP
// We get this ID automatically using the name.
var link_field_name = "Ebay Sale";
var link_field_id = form.getFieldNamed(link_field_name).getId();
// --- 2. EXECUTION ---
var ebayFormName = "eBay Sales";
var ebayForm = document.getFormNamed(ebayFormName);
if (ebayForm) {
// Create the new record in eBay Sales
var newEbayRecord = ebayForm.addNewRecord();
// Copy the data
newEbayRecord.setFieldValue(ebay_coin_type_id, record.getFieldValue(coin_type_id));
newEbayRecord.setFieldValue(ebay_year_id, record.getFieldValue(year_id));
newEbayRecord.setFieldValue(ebay_mint_id, record.getFieldValue(mint_id));
newEbayRecord.setFieldValue(ebay_cost_id, record.getFieldValue(purchase_price_id));
var photos = record.getFieldValue(photo_id);
if (photos) {
newEbayRecord.setFieldValue(ebay_photo_id, photos);
}
// Link the new record back to the current Coin record
if (link_field_id) {
record.addRecordToField(newEbayRecord, link_field_id);
} else {
console.log("Error: Could not find a link field named '" + link_field_name + "'");
}
// Save
document.saveAllChanges();
console.log("Success: Record moved and linked.");
} else {
console.log("Error: Could not find form named " + ebayFormName);
}
}
CopyToEbaySales();
-
This topic was modified 1 month, 3 weeks ago by
Brendan.
You can delete a button on the universal layout. Make sure you’re in layout edit mode and then tap the (x) button in the corner to delete it. But there may be an issue right now with selecting which script to use. It was working, but something must have changed just before release. I’ve already fixed it today so when you tap the button on iOS it will display the list of form scripts to select from.
It already works on macOS.
Hi Glen,
The script seems to be working. I just had to do a ‘recalculate formulas’ on the records.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Incomplete synchronization with Cloud+ persisted in ver.1.1, but after importing into a new file and rebuilding it, synchronization became possible.
The synchronization date and time for the encrypted database is not displayed on the iPhone.
Now easier to use with universal layout
It’s convenient to be able to run scripts with buttons. Until now, I’d been using radio buttons as a substitute.
The buttons in the universal layout cannot be deleted or edited.
You gave me the script to add data from the previous record to the current record and I have it installed in my form, and I changed the reference to the previous record I think, but it isn’t working.
Can somebody solve this for me looking at my tfarc file?
I want todays data added to the running total of the previous record so the total gets bigger every record added.
Attachments:
You must be
logged in to view attached files.
If you export your records as CVS, there’s an option to export all media as well. That should do the trick.
Otherwise, you could export them using a script.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
I’m using Cloud+, but synchronization is sometimes incomplete.
Records are created, but data is sometimes not copied.
Clicking a field triggers synchronization.
Changes made via script are sometimes not synchronized.
After synchronization, the form icon sometimes reverts to the default.
Linked records may not appear in the link field.
The link itself is working.
Sometimes the record does not switch to the newly created record. (Since ver 1.0.15 or earlier)
Even after modifying the data, the list view does not visually sort. (Since ver 1.0.15 or earlier)
I’m not sure if this is the right place to be asking a subscription question but my guess is there will be a number of you have had the same question.
I have just upgraded from 5 to Pro. With 5 I was able to have Taps 5 installed on both my wife’s machine and my own using my registration number.
Now, however, my license has come through the App Store and is thus tied to my Apple ID and my wife’s machine is tied to her Apple ID.
Does this mean that now I will need to subscribe to two separate licenses tied to, our separate IDs?
Please understand this is absolutely not a moan. If I need to I’m more than happy to take another license ……………… but if I don’t I’ll be happier still!
DavidMac
Hi Michael,
If your data is in a form, you can use saved searches and filter for your condition. This way, only the relevant records are shown. When you look at them in multi-column list view, you can get your total costs.
Sometimes, I write scripts for reporting and display the result in an external browser.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Grüezi,
Thanks for the code snippet, I’ll try it out later, including your ScriptHandler. By the way, while we’re on the topic of scripts, there might be a translation error in the German version. In the script overview, there’s a section with the little gear icon… it says “move to document,” but there is no “document” in the German overview. I think it should say “favorites,” and under “favorites” it should then say “switch to Formular.” I think the translation isn’t quite correct here.
Nice Week
Steve
You could try with following code snippet. Just add this at the beginning of your script. It adds the fetchRecordsWithMatch() function to the form object and presumably does a similar (or better?) thing than fetchRecordsForSearchTerm():
// form.fetchRecordsWithMatch
// Returns all records where the specified field matches the given value.
CDForm.prototype.fetchRecordsWithMatch = function(field_id, value){
return this.fetchRecords().filter(x => x.getFieldValue(field_id) == value);
}
And then instead of var auswahlRecoredsMonatsuersicht = formularMonatsuebersicht.fetchRecordsForSearchTerm('2026', feldJahrID); use var auswahlRecoredsMonatsuersicht = formularMonatsuebersicht.fetchRecordsWithMatch(feldJahrID, '2026');
This will return a record where all records are an extract match. This is what I have in my TF API Extensions script.
Viel Spass!
-
This reply was modified 2 months, 3 weeks ago by
Daniel Leu.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks