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 - 1 through 15 (of 3,150 total)
  • Author
    Search Results
  • #54776
    John Hamill
    Participant

    I provide below some follow-up information on Tapforms ‘Date type’ fields while using JavaScript. I include this information as it may save users some time in the future as they navigate the many “minefields” I encountered when using date objects.

    COMPARING DATES IN TAPFORMS:

    ‘Date type’ fields in Tapforms are held containing both the date and the time. The following Javascript program operates upon a ‘date object’ which contains a date with no associated time (courtesy, https://www.geeksforgeeks.org/javascript/compare-two-dates-using-javascript/).

    ——– Script excerpt ——–
    const date1 = new Date(‘2024-08-29’);
    const date2 = new Date(‘2024-09-01’);

    if (date1 < date2) {
    console.log(‘date1 is earlier than date2’);
    } else if (date1 > date2) {
    console.log(‘date1 is later than date2’);
    } else {
    console.log(‘date1 and date2 are the same’);
    }
    ——– End excerpt ——–

    Comparison operators (as demonstrated in the above script) report accurately with a ‘date only’ object. This behaviour may NOT operate as expected when the time element is included within a date object. Some of these “problems” are described in the enclosed email conversation with Brendan Duddridge.

    As a result, one might consider the option of comparing dates using “stringification instead of comparing two date objects. I have tested this myself and it works perfectly well with Tapforms ‘date type’ fields.

    STRINGIFY A DATE

    The following text is from https://stackoverflow.com/questions/14781153/how-to-compare-two-string-dates-in-javascript:

    Despite some confusion in the comments here, this [comparing dates after stringify^] does work for all YYYY-MM-DD dates. The original question was asking about “m/d/yyyy” dates, but most of us are using YYYY-MM-DD internally, so this is the best solution for most cases.

    ^ To stringify a date to ‘YYYY-MM-DD’ (Courtesy, https://www.geeksforgeeks.org/javascript/how-to-format-javascript-date-as-yyyy-mm-dd/):

    ——– Script excerpt ——–
    const formatDate = (date) => {
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, ‘0’); // Months are 0-indexed
    const day = String(date.getDate()).padStart(2, ‘0’);

    return ${year}-${month}-${day};
    };

    // Example usage
    const currentDate = new Date();
    console.log(formatDate(currentDate));
    ——– End excerpt ——–

    **** Example usage for a Tapforms date type field: ****

    ——– Script excerpt ——–
    const formatDate = (date) => {
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, ‘0’); // Months are 0-indexed
    const day = String(date.getDate()).padStart(2, ‘0’);

    return ${year}-${month}-${day};
    };

    function f_script_correct() {

    const prescription_date_obj_val = record.getFieldValue(‘fld-32bdd5c589f347e7add9b39c9a2099a4’);
    const prescription_date_obj_val_previous = record.getFieldValue(‘fld-f04dfccc25e14986894a5d77a8370ad6’);
    var prescription_date_string_val = formatDate(prescription_date_obj_val);
    var prescription_date_string_val_previous = formatDate(prescription_date_obj_val_previous);

    if(prescription_date_string_val == prescription_date_string_val_previous)
    Utils.alertWithMessage(‘Date’, ‘The same date’);
    else
    Utils.alertWithMessage(‘Date’, ‘Different dates’);

    }
    ——– End excerpt ——–

    ********* Javascript date issues **********
    In summary, the use of dates within Javascript (comparing dates, calculating days between dates etc) is a minefield as evidenced by the email exchange with Brendan Duddridge. I have found through research that the functions above solve some of these problems when using ‘Date type’ fields within Tapforms.

    This solution is for comparing dates absent the time element. If your program environment is dependent upon daylight saving time or time zones (for example), this solution may not be suitable. Note also that this information has not addressed the addition and subtraction of dates (date arithmetic). As explained in the email exchange, there are inaccuracies (of typically one day) when utilising the function ‘getDaysBetween(date1, date2)’.

    Keywords (to aid forum search): comparing dates; date comparison; javascript date problems; days between dates; subtracting dates; error NaN; undefined; date object; calculating dates; date calculation

    Attachments:
    You must be logged in to view attached files.
    #54770
    Philippe Dupont
    Participant

    Hello everyone.

    I can easily understand Brendan’s point of view regarding subscriptions.
    But as a casual, non-professional user, this doesn’t suit me.
    And with macOS 28 on the horizon, Rosetta will no longer be available, meaning my version of Tap Forms will no longer work.
    I’m sorry to say it, but I’ll have to look for something else…

    Does anyone have a ‘lightweight’ alternative to suggest?
    Mac + iOS, no subscription and at a reasonable price (no thanks to FileMaker – I wouldn’t have any use for it anyway).
    Thanks in advance for any advice…

    #54739
    John Hamill
    Participant

    Hello,

    I am using JavaScript and I have a situation where I need to reset a particular field to null if another field in a record has “changed value” (been amended by the user).

    My understanding is that in a field level script, the script will only be executed if a getFieldValue command is included in the script – this is the trigger to execute the script. Once the script is executed, the script will then reference the *new* values that the user has entered.

    Considering this, how can I determine if a user has amended a particular field in a record. I have the information that the user has definitely changed some of the data in the record, but how can I determine if he has changed a value in a particular field?

    Thanks for any assistance.

    • This topic was modified 1 week, 1 day ago by John Hamill.
    • This topic was modified 1 week, 1 day ago by John Hamill.
    #54734

    In reply to: Any ideas?…..

    Brendan
    Keymaster

    Hi Michael,

    If you’re referencing a Link to Form or Table field in a Calculation, you will get COUNT() as the aggregate calculation for a non-numeric field. That’s because there could be multiple records in the Table or Link to Form field, so Tap Forms doesn’t know which record you want to get the value of. So it defaults to an aggregate function.

    If you want to get the value of a specific field and a specific record in a Table or Link to Form field then you have to use a Field Script for that. I’m not sure what you mean though that Scripts can’t seem to show a result of a cascading Pick-List. I don’t know what your script looks like, so I don’t know if what you’ve programmed is correct or not. And I’m also not sure why the Child record loop isn’t working. Did you select a field from your child form before you double-clicked on the Child record loop script?

    Thanks,

    Brendan

    #54733
    Michael Dandeo
    Participant

    I need to copy the result of a pick-list and display into a different text field.
    The pick-list is a Cascading Pick-List inside a table and I only need the primary category.
    Category 1
    Category 2
    Category 3

    Why am I trying to do this…..Having a pick-list inside a table means its not searchable and Tags doesn’t seem to work either. Also can’t display it in a column in records view.

    What doesn’t work….
    When I create a new separate calculation field to pull the column from the table it copies over as a COUNT(), which obviously doesn’t work even if its set to display as text.
    Scripts can’t seem to show a result of a cascading Pick-List but does show in Log with no errors, just blank. Child record loop doesn’t work either.

    I know what im doing can be fixed by having 3 separate text (Pick-List) fields. But since every record needs all 3 Categories, why not save space and make the form flow a little better.

    Any suggestions would be helpful. Hoped I described in a way that makes sense to someone else.

    #54715
    Brendan
    Keymaster

    Hi Pierre,

    Tap Forms Pro 1.5 will now have a built-in MCP Server. I apologize if I’ve stepped on your JavaScript implementations. I’ve had a few requests for it recently, so it seemed like a good time to work on it.

    It’s of course a work in progress and it will be great to have your feedback once it’s published.

    Thanks!

    Brendan

    #54712
    Daniel Leu
    Participant

    Yep, the API is very powerful and thankfully, Brendan has always an open ear to add some new features, as he did for my MCP implmentation!

    I didn’t look at your code, but based on your description, I did about the same thing. One thing I noted is having special prompts greatly improves results. Initially, I just had fetchRecords, but then Claude fetched all records to perform a search. So adding searchRecords with an additional field filter reduced the data Claude had to process. It’s a fun project!

    Cheers, Daniel

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

    #54706
    PierreBn
    Participant

    Hi Brendan, Daniel,

    Thank you to you both.
    I didn’t realise how rich the Tap Forms scripting API was. So I built my own MCP connector on top of it.

    It runs a local http server on the Mac, plus one form script (“MCP Bridge”) in the TapForms document. Claude and the ChatGPT Mac app (or any MCP compatible AI) can then search, read and edit records. The AI only fetches the records it needs. So no huge exports, Brendan, which was your main worry about tokens.

    It can read and write most field types, links, tables, photos and files. Every change needs my approval in the AI app. Deletes need a click in a Mac dialog, and a backup is made first.

    Daniel, your unofficial API reference was a huge help. Table columns and link types come from properties documented there. Thank you! I am sure your version is cleaner than mine

    Brendan, I also noted a few things I ran into in the API while testing. They might be overall API limitations (outside of the MCP use case). For example, clearing a date field from a script doesn’t seem to stick, and local files can’t seem to be attached with addFileFromUrlToField. The full list, with steps to reproduce, is in the docs folder (tapforms-issues.md).

    WARNING: I want to be very clear this was vibe coded (with Claude Opus 5.5) and only partially human reviewed by me (just a hobby-developper). It has been tested on a copy of my database, and I will keep testing it in daily use. But it is NOT production ready in any way. Only try it on a copy, with a backup.

    Download: file attached.
    Start with the README, then docs/setup.md.

    This works for me for now. But it would be great to have an MCP server built into Tap Forms one day (Joplin still a good example: the MCP server runs inside the app itself).
    It would make this user friendly and more accessible to (nothing extra to install or start, no need to paste the script into every document…).

    Pierre

    #54705
    Daniel Leu
    Participant

    Right now, I haven’t posted the MCP script yet. Busy with other work.

    Cheers, Daniel

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

    #54696
    PierreBn
    Participant

    Hi Brendan,

    Thanks for the detailed reply! I’m glad to hear about the additional flexibility coming in 1.5, and it’s interesting to hear what you’ve already tried with the chatbot.

    I can see the difficulty with sending thousands of records to a model. An MCP connection could let the AI retrieve only the records and fields it needs (through an MCP-driven search into tapforms), using an AI subscription many of us already have: with a compatible client, this could work within the AI subscription limits (ChatGPT Pro, Claude…), without buying separate API credits on top of ChatGPT Plus/Pro or a similar subscription. The connection between the AI desktop app and Tap Forms through an MCP would run locally on the Mac, between the desktop AI app and TapForms.

    To answer your question, I use Tap Forms for many things, including my model railway collection. I already use AI to research models from their manufacturer and catalogue number, gather their specifications, and format the results according to my database fields. Currently, I have it generate a CSV file which I then import into Tap Forms (an MCP would allow me to also upload or modify attachments directly).

    Some prompts I would find useful are for example:
    – “Research this model and prepare a new record using my existing fields and naming conventions. Check whether I already own it before adding it.”
    – “Find models with missing technical details, research those details, and show me the proposed updates with sources.”
    – “Find possible duplicate records, allowing for variations in catalogue-number formatting.”
    – “Check for inconsistent manufacturer names or railway-era notation, and propose corrections for me to review.”
    – “Summarise my collection by manufacturer and era, including purchase totals where available, omit models <100 euros.”
    – “Compare these newly announced models with my collection and tell me which ones I already have.”

    As I mentioned in my original post, the Joplin MCP integration has made this kind of interaction very useful for my notes. I’d love to have that same continuity with Tap Forms: research something in an AI conversation, consult my existing records, then save the results back after reviewing them.

    I know you’re developing Tap Forms on your own, and I appreciate the large work involved. Hopefully these examples give you a clearer picture of what I had in mind! Maybe other users have other use cases.
    In any case, I still love TapForms ;)

    Thanks again,
    Pierre

    • This reply was modified 2 weeks, 2 days ago by PierreBn.
    • This reply was modified 2 weeks, 2 days ago by PierreBn.
    #54692
    PierreBn
    Participant

    Hi,

    This was already asked in April ( https://www.tapforms.com/forums/topic/tap-forms-5-and-maybe-next-version-too-and-mcp/ ), and Brendan you didn’t have any plans for this.

    Just to check if this might have changed.
    I am in any case very interested! ;)

    My personal opinion on this:
    As AI becomes more widespread, there is a good overlap between technical users who may use a personal database software like tapforms and those that use AI more and more. It is now perfectly possible for someone to develop a simple, personal, custom database just with a few prompts (albeit of course not as good and rich in functions as tapforms – but maybe enough for some).
    Leveraging both AI and TapForms rich functions through an MCP connector would be the best of both worlds. An example of this: my note taking (with the open source Joplin) is now so much better thanks to their native MCP connector.
    It’s not about doing everything with AI, it’s about selectively using is. Being able to read, update, analyze or sort my tapforms records through an AI would be amazing with a native MCP (the script workaround isn’t really as safe and/or powerful IMHO). I respectfully think AI integration is going to be key to long term success of software suites (while also respecting those who want nothing to do with AI); particularly for data oriented software solutions like tapforms.

    Best,
    Pierre

    #54679

    In reply to: Upgrading TP5 to TPPro

    Trish Meyer
    Participant

    I tried that, but TapFormsPlus doesn’t show up as a Subscription (perhaps it’s because it’s a Lifetime purchase?)

    But I figured it out! I was Sharing Purchases with hubby, but he also had to Share his purchases too on his account. Once I did that, the “Subscribe” button went away, and the Settings have the Sync button and all is syncing!

    I found the answer on an Apple help page:

    “In order to share in-app purchases from participating apps, make sure that Share My Purchases is turned on for the account that made the purchase, as well as the account they want to share the purchase with. ”

    under Learn More at the end of this page.
    https://support.apple.com/en-us/111114

    Thanks for your patience, especially on a weekend.

    • This reply was modified 3 weeks, 1 day ago by Trish Meyer.
    #54678

    In reply to: Upgrading TP5 to TPPro

    Brendan
    Keymaster

    Yes. Go to the Manage Subscriptions screen on your Mac, then click on Tap Forms Pro on your list of subscriptions. You should see it say Family and there should be a switch that you can turn on or off to share the subscription.

    #54677

    In reply to: Upgrading TP5 to TPPro

    Trish Meyer
    Participant

    Yes, he clicked “restore purchase” a few times, but it just says that he has never purchased it before. Dialog pops up with message:
    “Your App Store account has no previous subscription to Tap Forms Pro. Ensure you are logged in with the correct App Store account or purchase a new subscription.”

    Anything else we could check?

    #54673

    In reply to: Upgrading TP5 to TPPro

    Trish Meyer
    Participant

    Thanks, that makes sense now. I’ve fixed my two Silicon Macs (I hope, using Local Documents folder as the default).

    I’ve installed Tap Forms Pro on my husbands laptop. He is on my Family Sharing (I am the “organizer”). He went to the popup that says “Purchased by Trish” and downloaded TapForms Pro from that page.

    But when he added the master database, it only shows 10 records and is asking him to pay for it.

    We’ve double checked everything on Apple App Store. TapForms Pro does not show up under his Subscriptions. I’ve waited a couple of hours to see if it was an Apple Store delay, but still on trial version.

    Is there something we’re missing? It said Lifetime included Family Sharing. Thanks.

Viewing 15 results - 1 through 15 (of 3,150 total)