Pick lists w/ comment

Viewing 5 reply threads
  • Author
    Posts
  • March 15, 2026 at 2:33 PM #53670

    Glen Forister
    Participant

    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?

    March 15, 2026 at 3:29 PM #53674

    Daniel Leu
    Participant

    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 4 weeks ago by Daniel Leu.
    • This reply was modified 4 weeks ago by Daniel Leu.

    Cheers, Daniel

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

    March 15, 2026 at 4:05 PM #53677

    Glen Forister
    Participant

    That sounds possible if I understand it. I’ll play with that.
    Thanks.

    March 15, 2026 at 6:10 PM #53685

    Brendan
    Keymaster

    I’ve just made a modification to Tap Forms Pro that will extract out the number values from a Pick List attached to a Number field. So you’d be able to setup a Pick List like this:

    10 Red
    20 Blue
    30 Green
    40 Yellow
    199.23 Unknown

    And when you select the value, just the numeric part will be assigned to the Number field.

    Attachments:
    You must be logged in to view attached files.
    March 16, 2026 at 4:21 PM #53700

    Glen Forister
    Participant

    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.

    March 16, 2026 at 11:35 PM #53702

    Daniel Leu
    Participant

    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

    March 17, 2026 at 9:45 AM #53713

    Glen Forister
    Participant

    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.

Viewing 5 reply threads

You must be logged in to reply to this topic.