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 - 361 through 375 (of 2,989 total)
  • Author
    Search Results
  • #50840
    John Hamill
    Participant

    Thanks for the reply, Brendan.

    I believe your statement (that the getFieldNamed function is not disabled) is somewhat semantic. Maybe I am wrong, but my understanding of what you are saying is that the following process occurs in a field level script:

    Prerequisites for execution of a field level script:

    1. The function ‘getFieldValue’ MUST be present.
    2. A valid fld_ID value MUST be present. This value can be explicit or the value can be contained within a variable.

    Process:
    1. Tapform’s Objective-C code scans the source code in my script.
    2. It finds the function ‘getFieldValue’.
    3. It fails to find a valid fld_ID as the code (within the field level script) has yet to be executed as a Javascript.
    4. As the prerequisites have not been satisfied, no script execution actually takes place.

    What I am saying is that the ‘getFieldNamed’ function and its use within a field level script are basically incompatible as (at the Objective-C code scan stage), there will NEVER be a fld_ID to satisfy the second prerequisite stated above.

    That effectively makes useless any inclusion of ‘getFieldNamed’ in a field level script (for its primary function of retrieving a fld_ID). I agree that the function is not disabled, but it is inoperable (useless) within a field level script.

    That is my reading of it, but perhaps my understanding of the process above is wrong?

    #50834
    Brendan
    Keymaster

    The getFieldNamed() function is not disabled. It just doesn’t cause the field script to be executed when you enter a value into that field in the record. If there was another field that’s referenced with the field ID directly, then that will trigger the script to run.

    The trigger is specifically on the getFieldValue() function.

    #50833
    John Hamill
    Participant

    So if I am understanding this correctly, that function (getFieldNamed) is effectively disabled within a field level script.

    The script text MUST (at the outset) contain the fld_ID of a field that will “change value”.

    So any function that returns the fld_ID will be ineffective in a field level script (unless the script already contains a fld_ID). Perhaps getFieldNamed is the only function that does that?

    I cannot think of a workaround as you are very much limited when using a field level script.

    Is this correct?

    Thanks for help.

    #50824
    Brendan
    Keymaster

    The issue is that my Objective-C code scans your source code to determine which fields you’re referencing in the script by looking for the text .getFieldValue('fld-.....'). Or when using a variable instead of ('fld-....'). But it doesn’t execute your code before your function is run to determine what the field ID is for getFieldNamed('Analysis_G2') so that it can trigger the script when that value in that field changes.

    It works as a Form script because you’re manually executing the script when you want. But a Field script relies on monitoring the fields in the form to see what’s changed and then it runs the script if the script has a reference to one of those fields with the hard coded field ID.

    After you save your script, check the Fields list to see if you see a checkmark next to any of the fields. If so, those are the fields Tap Forms will monitor for changes. If you don’t see any, the script won’t be triggered automatically.

    #50822
    Brendan
    Keymaster

    Ya, that would be easier to read and debug with a Script field. But can be done with a Calculation field:

    IF(FieldA = 1; DATEADD(FieldC;0;0;-2;0;0;0;0); IF(FieldA = 2 ~ FieldA = 3; DATEADD(FieldC;0;-1;0;0;0;0;0);  IF(FieldA > 3; DATEADD(FieldC;0;-2;0;0;0;0;0); "")))

    I haven’t tested this, so it might not work, but that’s the general idea. The ~ character means or

    #50819
    Mitz
    Participant

    Hello Brendan, i am having issues with IF Nesting Functions. I searched and found that it is much simpler/easier to use script. However, i do not know Script. I saw the tutorial and was having a hard time comprehending. Anyway, I hope you can help if the formula. I need Field B to show 3 results, depending on 4 conditions:

    if Field A is 1, result is 2 weeks before the date in field C
    if Field A is 2 or 3, result is 1 month before the date in Field C
    if Field A is more than 3, result is 2 months before the date in Field C
    if Field A is 0, Field B should be blank

    Thanks so much in advance! TapForms is GREAT!

    #50818
    John Hamill
    Participant
    A javascript runs correctly with a “hard coded” field_ID. It fails however if the field_ID is retrieved using the functions ‘form.getFieldNamed(‘field_name’)’ and ‘object.getId()’.
    Can anyone see why this might not work? I intend to use this function in ALL of my forms. Hence the need to source the field_ID from its ‘field name”.
    Thanks for any help.
    The code is quite straightforward (you can substitute any field id below to test it). If the user enters “XXYY” in the field, it should set that field to ‘null’:
    function Script() {
    // ***** OPERATES CORRECTLY *****:
    // the following two lines of code work correctly (when the field id
    // hardcoded).
    var analysis_g2_fld_id = ‘fld-37435e1d73024374b4700105e49993c9’;
    var analysis_g2_value = record.getFieldValue(‘fld-37435e1d73024374b4700105e49993c9’);
    // ***** FAILS *****:
    // the following three lines of code do NOT work
    // (ie. when the field ID is sourced via functions). If the three
    // lines of code below are executed in a “form level script”, it does
    // work. It is only when in a “field level script” that it fails.
    // analysis_g2_obj = form.getFieldNamed(‘Analysis_G2’);
    // var analysis_g2_fld_id = analysis_g2_obj.getId();
    // var analysis_g2_value = record.getFieldValue(analysis_g2_fld_id);
    if (analysis_g2_value == “XXYY”)
    record.setFieldValue(analysis_g2_fld_id, null);
            return 0;
    }
    Script();
    form.saveAllChanges();
    #50814
    Olivier Ragasol
    Participant

    царь means tsar, all the entries are in cyrillic script. (The definitions are mostly in roman.)

    Quite oddly, a simple search — or an advanced search restricted to Domaine — with Aliments et boissons (Food and drinks) doesn’t yield anything, a search with Aliments only either. Instead, boissons yields all the records related to food and drinks…

    #50791
    Brendan
    Keymaster

    Hi Stephen,

    Just setting the value in the field should trigger the record colour value to update. Can you post a sample form template with your script inside so I can see what’s going wrong?

    Even something simple like this works:

    function Change_Value() {
    var new_field_id = 'fld-eeda81519fa94abab133b9a2b4d7847b';
    record.setFieldValue(new_field_id, "Two");
    form.saveAllChanges();
    }
    Change_Value();

    Have you made sure that you’re calling form.saveAllChanges()?

    Attachments:
    You must be logged in to view attached files.
    #50788
    Stephen
    Participant

    I have a field for progress Status, it’s formatted as radio buttons from a pick list with 3 values – Pending/Actioned/Archived.

    I would like to set the record colour based on this status. null/yellow/green.

    I have used the set record colour attribute before, but only set from a tick box, so the logic was simple. Try as I might, I cannot find how to achieve what I want. How is the value of a Radio Button field stored & referenced in the script, for example? I’ve tried as if it were the text, and if it was stored as a number, but no success thus far.

    Any advice?

     

    Many thanks, Stephen.

     

    #50775
    Torsten Reim
    Participant

    Hello,

    following assumption:

    I have two forms:

    form 1

    form 2

    I have a script in form 1 (not a script field). How can I get the records that are in form 2 from form 1 and display it in the console?

    I tried several days but I can not access the records in form 2.

    Regards from germany.

    #50767

    In reply to: Tap Forms for RAG

    Brendan
    Keymaster

    Hi James,

    That’s an interesting use case for AI. We’ll see what Apple has up its sleeves for integrating AI into their OS. Right now the script I wrote simply establishes a REST connection to OpenAI and submits a message and gets a response. I also wrote another script I can use for translating forms to different languages. It’s still a work-in-progress though.

    I agree better AppleScript and Shortcuts support is needed. You can also call into Tap Forms with a URL that can execute a script. You can even pass Tap Forms parameters that way.

    See the section on this page called “Calling a Script from a URL”:

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

    Thanks,

    Brendan

    #50764

    In reply to: Tap Forms for RAG

    JScottA
    Participant

    I think you are thinking of calling an LLM from within Tap Forms. That is another use case. I’m suggesting that Brendan look into making sure his tool is set up for the various GenAI tools are able to access Tap Forms database easily. This could be accomplished by providing an API into Tap Forms, AppleScript, or Shortcuts. Each method has pros/cons, but all should probably be pursued.

    However, I think that Brendan, like everyone else in the Apple ecosystem, is waiting to see what Apple does with AI. Hopefully, the annual release schedule with long times before actual release will not cause Apple a fall similar to Nokia/Blackberry. And annual release schedule in a world where the state of the technology and tools/products is advancing daily seems like a very bad idea.

    #50763

    In reply to: Tap Forms for RAG

    JScottA
    Participant

    Good morning, Brendan. RAG is a technique for a Generative AI (GenAI or just AI these days), to access a specific external data source for specific knowledge. For example, a chatbot on a website for customer service or sales support would be best if it had a live, up-to-date, source of information for policies, procedures, products, and services. One or more databases would be linked to the chatbot so that it has what it needs to give good information and not hallucinate or just be ignorant of possible answers.

    So, to keep it simple, imagine a Tap Form database of internal contact information for a company. It would have your standard phone numbers, email addresses, physical addresses, etc. and maybe a bit on the actual responsibilities and authority of each person. If you wanted to find the right person in your company to deal with an issue, you could explain the issue to your internal chatbot and it would be able to find the right person or people for you.

    And this goes beyond keyword searches. GenAI is able to infer intent and additional meaning and context from a conversation. Hopefully, Apple will provide you with the Core[whatever they call it] framework so you can integrate GenAI directly into your app for directly helping users with your app.

    But the first thing I thought of as a useful tool would be access to a database for structured RAG that is also local and live. If you ever want to discuss the possibilities and potential methods of executing and of this let me know.

    As a side note, I’m really hoping that Apple will integrate GenAI into Xcode for enable faster, better, app development. There are so many possibilities with this in Xcode.

    BTW…you may want to consider beefing up your AppleScript support and adding Shortcuts triggers/actions.

    A use case for this (and it would replace my current use of AirTable and Zapier Tables) is helping a Mac magazine with the press release handling. This is where they have a bunch of RSS feeds from manufacturers that cover the company news (press releases) that each sends out. The workflow pulls the press release (article) information from the RSS feed and places all of the information into a database (AirTable for this one). Then the workflow goes through a variety of tasks that use Generative AI to perform. Finally, a magazine editor reviews the processed articles for publishing and makes the decisions on things like titles, pull quotes, summaries, adds opinions, images, etc. All of this and the status of the article is stored in the database. Finally, the workflow pulls the final article information from the database and publishes it to the various platforms (magazine website, X.com, LinkedIn, etc.).

    Sorry for the long post, but I see a huge opportunity here for a local Mac database tool. Filemaker has blown it for smaller developers with local use cases because of their cost. I think that aggressive AI integration and positioning as a local Mac RAG resource could be a nice first mover for you.

    Have a great day.

    #50761

    In reply to: Tap Forms for RAG

    Chris Ju
    Participant

    I suppose many LLMs should be possible (e.g. Meta LLaMa) because many of them can be called with http/url commands using JavaScript …

Viewing 15 results - 361 through 375 (of 2,989 total)