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 - 796 through 810 (of 2,989 total)
  • Author
    Search Results
  • #47972
    Bob Williams
    Participant

    I frequently have multiple edit windows open for note or markdown fields, sometimes from the same record and sometimes from multiple records. One problem I keep running into is that I frequently confuse which window is for which notes field because there’s just not enough info in the title to differentiate. As an example, I have three windows open right now on note fields from three rows of a table, and all three are titled Notes - Occurrences – with Notes being the table field’s name and Occurrences being the form’s name, both of which are the same for all three fields/windows. Often when this happens, I end up closing and reopening all of them to straighten things out mentally.

    To help, I try to position each window uniquely and then use position as a factor to identifying which window is which. However, this doesn’t get me very far because the main database windows are positionally tied to the edit windows: move the former, and the latter move with it, as though they’re one unit. So if I have multiple databases open at the same time (as I usually do), if I move one of the main windows so that I can better see something else, everything shifts and my spatial system breaks down.

    Thus, I’d like to propose adding more information to the title of the edit windows. To ensure there’s always enough info to differentiate, you’d probably need to do something like <form name> - <record’s first sort value> - <field name> [- <row number>], with the last part only applying to table-ish-type fields. That’s probably a bit much, so some configurability would be nice. Ideally, you’d just have a place for me to specify this in the field properties, maybe using tokens or even a calculation/script. Then I could do cool things like mix static text with the DB name, the form name, other field’s values, or a particular table column’s value.

    #47963
    Brendan
    Keymaster

    Hi Stephen,

    There’s no function in the JavaScript API to change a form’s sort and group settings.

    Can you give me a use case for needing this feature?

    Thanks,

    Brendan

    #47959
    Stephen Meehan
    Participant

    Hi, is it possible to configure sort preferences through a script, as opposed to using “Sort & Group Settings” in the forms inspector panel?

    Seems like field.sortOrder simply specifies field order in the form inspector, but maybe I’m misunderstanding its use?

    #47952
    Brendan
    Keymaster

    Hi Mike,

    There’s a setting on Number fields to display the value red if it’s negative. But not for Date fields that are past due.

    But you could use a Script field to return an Emoji character that’s red along with some text perhaps such as “OVERDUE ‼️”

    • This reply was modified 3 years, 4 months ago by Brendan.
    #47951
    Brendan
    Keymaster

    The way Tap Forms separates values for a multi-select Pick List is to separate them by a comma and space character. There’s no function to change that, but what you could do is create a Script field which strips out the comma from the values you set.

    The JavaScript function cleanedHashTags = hashTags.replace(",", "") would do what you need.

    #47943
    Daniel Leu
    Participant

    Unfortunately, there is no API available for that, but I have a game plan!

    This is how I would approach this:
    1) create JSON object from current record
    2) convert JSON object to csv object. A quick google search provides several hits. I like Christian Landgren’s updated solution in https://stackoverflow.com/questions/8847766/how-to-convert-json-to-csv-format-and-store-in-a-variable)
    3) copy csv object to clipboard using Utils.copyTextToClipboard(csv_object)
    4) call AppleScript using custom URL script to finish up (see https://www.tapforms.com/forums/topic/automator-scripting-auto-folder-creation/#post-47673 for more about that topic). The AppleScript would take the content of the clipboard and save it in a file. It looks like you can upload the file to Google Drive as well.

    It should be possible to automate your export steps. But as you can see, there are a few challenges ahead. Good luck and have fun!

    Cheers, Daniel

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

    #47940
    Michael Shapiro
    Participant

    Is there a way to automate Tapforms’ existing Export Records function? I’d love to be able to run a script that basically exports the current thing I’m looking at as an Excel file. (Ideally I’d love to have an automated “export, then publish to Google Sheets” kind of functionality, but at the moment I’d be happy just reducing the number of steps.)

    I’m an ignoramus of Javascript, though I can hack my way along by modifying others’ code. Same applies to AppleScript.

    Thanks in advance for any suggestions!

    Mike

    #47931
    Brendan
    Keymaster

    Yup. That’s right Mike. You can also use the Duplicate command under the Form menu.

    And Siamak yes you can use the Calculation field to combine fields. You can also use a Script field too.

    #47919
    Brendan
    Keymaster

    You can find all the commands Tap Forms supports here:

    https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api

    #47917
    Daniel Leu
    Participant

    Yes, there is

    var copyOfRecord = record.duplicate();
    document.saveAllChanges();

    You can execute this from a form script.

    Cheers, Daniel

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

    #47916
    dan carter
    Participant

    Hello All,

    Does Tap Forms have a script command to duplicate the record currently being viewed. Have tried Duplicate(this) with no luck.

    Many Thanks, Dan

    #47893
    John Cranney
    Participant

    It does make sense, thanks.

    I was trying to get it to work using a script and I think I found some odd behaviour.

    Say I have a linked form (stuff_link_id) and a table that I want to display a view of records in that table (stuff_table_id). If I click the checkmark button as you mention above, I get a copy of the selected stuff_link record in my table, with values magically populated.

    However if I run the following (which I was hoping would populate the table with a view of whatever is linked in link) it deletes the record from link and moves it to table. Is that intentional? I expected it would do the same magic population. I’ve got a workaround which is to use duplicate() but I need to manually set all the columns.

    var records=form.getRecords();

    for (var rec of records){
    for (var stuff_rec of rec.getFieldValue(stuff_link_id)) {
    rec.addRecordToField(stuff_rec,stuff_table_id);
    }
    }

    document.saveAllChanges();

    #47883
    John Cranney
    Participant

    In the table field properties, there is a dropdown called “Copy records from”.

    Under this dropdown, it says “Tap Forms will copy values from the selected records based on matching field titles”.

    What does this functionality actually do? From the description it looks like it can be used to populate a table with data (I want to use a table to show data from a linked form, as on iOS tables are the only way to view nested data without clicking through).

    However I can’t get the feature to do anything for me.

    Attachments:
    You must be logged in to view attached files.
    #47871
    Yan Cowles
    Participant

    Belay that – I got your script working!
    Not sure how to explain but I had to double click the ‘line totalx’ elements to place them in the formula rather than typing out.
    Attached image possibly shows this.

    Anyway, I think I can work with this so much appreciated – thanking you kindly Daniel.

    Attachments:
    You must be logged in to view attached files.
    #47870
    Yan Cowles
    Participant

    Thanks for the quick reply Daniel, unfortunately, the formula doesn’t seem to do anything and I get nothing in the Total calc field at all so I’m probably doing something wrong but I can’t figure out what.

    I find the table incredibly difficult to deal with as I would want to turn off things like row and column titles which it doesn’t seem to allow.

    Sigh, I guess I’d best attempt to deal with some javascript, er, any chance you could point me in the right direction?

Viewing 15 results - 796 through 810 (of 2,989 total)