So….
This script grabs a line from from the “Red Rlue Green” defined picklist and parces it down to a number. (this works on laptop, but not on the iPhone). This value can then be grabbed by another field (Picklist property)?? But a Picklist field only grabbs info from picklists, not another field.
So, 2 problems. it doesn’t work on iPhone. And picklist can’t pick from a field.
So, I guess this script doesn’t do anything for me????
Way confused.
There’s no picklist on the script field. This script just creates a number from your input field which is just a regular text field with a picklist associated.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
Script fields aren’t meant to have Pick Lists on them. I just checked to make sure, but the Pick List option doesn’t even appear on the Script field properties panel on macOS.
Script fields are meant to just display a value computed from other fields in your form.
The picklist using a script (“Red Blue Green”) works, but using it on my iPhone 16 I discovered I can’t use it because the little picklist icon to touch to get the list is not there. No way to get the list.
Just for fun I put another field with a normal picklist and that works as expected with the icon at the right and it pops up the choices.
I guess it is because the filed is a Script type and that type doesn’t have a picklist option???
So, I guess that method doesn’t work on the iPhone?
I edited your post to make the code more readable. Just put a back-tick around it. One at the beginning and one at the end. The forum will format the code to make it easier to read.
Anyway, I don’t see anything wrong with your script.
Try putting a console log message before: record.getFieldValue(year_id) to see what you get:
console.log(record.getFieldValue(year_id));
First, I couldn’t past into that window so I had to type it in. Then later I discovered pasting from my keyboard doesn’t work, but the edit menu “paste unformatted” does the job. So, pasting your script in did work.
Thanks for the patience. That works just like I wanted. Sorry, I just don’t have time to keep the skills of scripting. Wish I did – it can be lots of fun.
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 3 months, 2 weeks ago by
Daniel Leu.
-
This reply was modified 3 months, 2 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 3 months, 1 week 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.