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 - 331 through 345 (of 2,950 total)
  • Author
    Search Results
  • #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 …

    #50760

    In reply to: Tap Forms for RAG

    Brendan
    Keymaster

    Hi James,

    I’m not sure what Retrieval Augmented Generation is. But yes, I’m waiting to see what Apple provides developers at WWDC. Hopefully something that doesn’t cost us to integrate into our apps.

    I did write a simple ChatGPT script in Tap Forms to call out to their service though. It worked pretty well. Type in your question or statement into a field, then it goes out and gets the response and populates the Script field with the results. Great to keep int he database and be able to do queries on it.

    But I can see other uses for AI such as to create forms for you or analyze your data.

    Thanks,

    Brendan

    #50751
    Daniel Leu
    Participant

    First you have to link the two forms. In F01a, create a link to form field and give it a name (eg link). Then set the link type to join, select F04a as the form to link to and use the MatTar and TarRef fields for the values.

    Next turn F01a.TarNam into a script field. Following field script should do the trick. I have added comments to describe what I’m doing:

    function getTarCln() {
       // get F014a form
       let f04a_form = document.getFormNamed("F04a");
       // get field id for TarCln
       let tarCln__f04a_id = f04a_form.getFieldNamed("TarCln").getId();
       // get field id for link field
       let link_id = form.getFieldNamed("link").getId();
       // get linked records
       let f04a_recs = record.getFieldValue(link_id);
       // check that there's only one record
       if (f04a_recs.length > 1) {
          console.log("Error, more than one record");
          return;
       }
       // get value from F014a form
       let value = f04a_recs[0].getFieldValue(tarCln__f04a_id);
       console.log("Value fetched: " + value);
       // done, return value
       return value;
    }
    getTarCln();
    This script assumes that the field that links the two forms together is called link. You can change this on line 10.
    The return type of the script must match your field type, eg Number, Text, Date.
    This is JavaScript and not Java. Although they share part of their name, they are totally different beasts.

    Cheers, Daniel

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

    #50727
    Brendan
    Keymaster

    That’s is a very use case specific need you have there. Unfortunately it’s in a domain I’m not very familiar with, so don’t have any specific recommendations, but I would suggest just trying some things out to figure out what works for you. You could also use the Duplicate Document command to make a copy of your document that you could experiment with without affecting your original document.

    Sometimes Table fields can be used in lieu of Pick Lists. They’re kinda like Pick Lists on steroids in that they can display multiple values at the same time, copied from another form, but you can add additional information to the Table field if needed.

    If you want to try scripting if you think that might be a solution to your problem, then there’s instructions for that here:

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

    Sorry I don’t have a better solution for you.

    Brendan

    #50725
    Daniel Kefford
    Participant

    I am very new to tapforms having just downloaded the trial on my Mac and then just bought the iOS version this morning and all my playing so far has been on iPhone.

    Basically I want to use it to keep a database of movies but not really in the sense of a standard movie database. I basically want to keep track of which tracks on a blu ray disc are which.

    so I basically backup all my physical discs and either store them as entire backup folders or ISO  for playback in home theatre. I also sometimes make an mkv instead and one of the issue with creating an mkv file from a blu ray disc is that a blu ray disc is full of playlist and video files and they are joined up in a certain way to give you the episode or movie you want to watch. If you don’t have the menus (because you are trying to pull a movie or an episode out of the whole disc and save it as a single mkv file) then it can be hard to keep a track of which playlist is the one you want. Once I have figured this out I want to keep the data.

     

    so basically I have a video form which represent a movie or episode or equivalent. That form has some fields (eg. mpls, title, type etc). The mpls is the playlist file that is the one I care about in this instance. An mpls file links 1 or multiple m2ts files together to give you the video you want. So I have a table inside the form as well with the list of segments that make up this video. So far so good.

    Then each m2ts file contains a number of streams (video, audio and maybe subtitles). Right now I have this as another table.

    ok, so far so good.

    So, now I can have another form for a physical disc that can link to a number of these video forms to represent the individual videos I care about on that disc. So that means I can quickly lookup and find out all the different info about the streams and segments.

    So that table describes the videos on a disc that I care about and that’s part of what I want.

    but now I also want another form that I will call MKV which I want to represent each mkv file I create from these videos. So when I take a video form item I will extract the video and make an mkv file so the mpls and m2ts segments used to make that mkv file are the same between the 2 forms so I can just join or link. However the tricky thing is that when I make an mkv file I do not keep all the streams. I just take the streams I want (ie. The video, the English, maybe the Japanese and some or none of the subtitles). So when I create a new MKV form I would like it to point to my “Video” form which has all the mpls and segment info and they are the same but then I want to select some of the streams from the stream table that is in the video form and I can’t figure out how to do it. Each time I create an mkv it would need to be a manual human action to tick the ones I want or something similar and then have them stored in the mkv form as a table. The data stored for each stream can be the same but I just don’t want all streams. The closest I could think of was some sort of pick list that I could populate with a table form another form. It would still be uglier than I would like but it might be ok but it also doesn’t work as I can’t populate a picklist with the contents of a table in a specific video form entry.

    Is there some way to script what I want? I guess I could create a separate stream form that is keyed by the video title and then within the “video” form I can use a join to collate them all back up into a full list and then have some sort of 1 to many table in the mkv table so I can select all the streams I want?

    is this the best/only way to do it?

    im not sure if I’ve totally lost everyone with my rambling description….

    any advice appreciated!

    #50705
    Brendan
    Keymaster

    Hi Evan,

    Sorry for missing this. Your message got caught up in the forum spam filter. Not sure why.

    1. You can do a mail merge if you add a static text object to your custom layout. Then type in the field names surrounded by square brackets. For example:

    Dear [First Name] [Last Name],

    It is of utmost importance that you pay your bill totalling [Bill Total] or we will have to charge you an interest rate of [Interest Rate]

    Then when you use the Print function, the values in the field placeholders will be substituted with the values from those specific fields for the printed record(s).

    2. Tap Forms doesn’t actually send out emails, but you can have it create an email in Apple Mail that’s addressed to a bunch of people in your records in your form. Use the Email Selected Addresses function under the Edit menu for that.

    3. There’s no automated workflow functions built-in to Tap Forms, but if you’re good at JavaScript, or willing to learn, you can program Tap Forms to do all kinds of things. You can have it trigger a script when the value in a field changes for example. Your script would execute and maybe it would insert another record into a linked form or have it change the value of another field or read in a file or do any number of things you’d like it to do.

    4. There’s no function to trigger scripts to run at specific times, but as mentioned above, you can trigger a script to run when the value of a field in your form is changed. So maybe you can do something with that.

    See this page for information on scripting in Tap Forms:

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

    Thanks!

    Brendan

    (and sorry for your post getting marked as spam).

    letnic
    Participant

    Hi,

    When in a Custom layout, if I go to print and use the Save as PDF function, is it possible to give a tile different than the layout?

    It’s an invoice layout, so I’d like it to have a formatted title like “YYMMDD_ClientName-Inv#”.

    Is this something possible? Maybe with a script, I don’t know.

    What do you think?

    Thanks.

    Fernando DS
    Participant

    Hello everyone, I have an amount search script in the table field of all records. But it works for me with some quantities and not with others. And I don’t understand why.
    This is the script:

    // Definiciones de IDs de campos dentro de la tabla
    var pagos_cobros_tabla_id = ‘fld-a878bb1af5534101bcfab905279b1180’; // ID del campo Pagos/Cobros dentro de la tabla
    var movs_banco_tabla_id = ‘fld-57a5fdcd593e46b298948845321d78ac’; // ID del campo Mvtos. Banco dentro de la tabla
    var fecha_id = ‘fld-547c13e982e84d0793b0aba6c220cf76’; // ID del campo de fecha dentro de la tabla
    var nombre_id = ‘fld-baf116cd116e4cde9b65e79014a49f28’; // ID del campo de nombre dentro de la tabla
    var tabla_id = ‘fld-d8a58dbf35914f3c858c6dfb880c1c48’;
    var nota_id = ‘fld-7918261f865b489a8f7672cf733712a9’;
    var listado_de_script_id = ‘fld-555622f4bf0344f9b9e92af0806210fc’;
    // Reemplazar ‘XXXXXX’ con el ID del campo “Listado de script”

    // Define el importe a buscar
    var buscarImporte = “19.99”; // Ajusta este valor según el importe que desees buscar

    console.log(“”);
    console.log(“*************************************”);
    console.log(“Importe buscado: ” + buscarImporte);
    console.log(“*************************************”);
    console.log(“”);

    // Inicializar el contenido del campo “Listado de script”
    var output = “”;

    // Función para parsear el importe independientemente del formato
    function parseImporte(importeStr) {
    if (typeof importeStr === ‘string’) {
    return parseFloat(importeStr.replace(/[^\d.-]/g, ”)) || 0; // Devolver 0 si el valor no se puede convertir a número
    } else {
    return parseFloat(importeStr) || 0; // Devolver 0 si el valor no se puede convertir a número
    }
    }

    buscarImporte = parseImporte(buscarImporte);

    var records = form.getRecords();

    for (var i = 0; i < records.length; i++) {
    var record = records;
    var registrosTabla = record.getFieldValue(‘fld-d8a58dbf35914f3c858c6dfb880c1c48’) || []; // Reemplaza ‘tabla_id’ con el ID del campo de la tabla
    var nombre = record.getFieldValue(‘fld-baf116cd116e4cde9b65e79014a49f28’); // Obtener el nombre fuera del bucle de la tabla

    // Array para almacenar los movimientos correspondientes a cada nombre
    var movimientosNombre = [];

    for (var j = 0; j < registrosTabla.length; j++) {
    var registroTabla = registrosTabla[j];
    var pagosCobros = parseImporte(registroTabla.getFieldValue(pagos_cobros_tabla_id));
    var movsBanco = parseImporte(registroTabla.getFieldValue(movs_banco_tabla_id));
    var fechaRaw = new Date(registroTabla.getFieldValue(fecha_id));
    var fecha = ${('0' + fechaRaw.getDate()).slice(-2)}/${('0' + (fechaRaw.getMonth() + 1)).slice(-2)}/${fechaRaw.getFullYear().toString().substr(-2)};
    var nota = registroTabla.getFieldValue(nota_id);

    // Comparar el valor absoluto de los importes
    if (Math.abs(pagosCobros) === Math.abs(buscarImporte) || Math.abs(movsBanco) === Math.abs(buscarImporte)) {
    movimientosNombre.push({ fecha: fecha, movsBanco: movsBanco, pagosCobros: pagosCobros, nota: nota });
    }
    }

    // Mostrar el nombre y luego los movimientos correspondientes
    if (movimientosNombre.length > 0) {
    output += “\n” + nombre + “\n\n”;
    console.log(“” + nombre);
    console.log(“”);
    for (var k = 0; k < movimientosNombre.length; k++) {
    var movimiento = movimientosNombre[k];
    output += ${movimiento.fecha}: ${movimiento.movsBanco} | ${movimiento.pagosCobros}\n\n${movimiento.nota}\n;
    console.log(${movimiento.fecha}: ${movimiento.movsBanco} | ${movimiento.pagosCobros});
    console.log(“” + movimiento.nota);
    console.log(“”);
    }
    }
    }

    // Actualizar el campo “Listado de script” del primer registro con el texto generado
    record.setFieldValue(listado_de_script_id, output);

    // Guardar los cambios en los registros
    form.saveAllChanges();

    Any help will be welcome.

     

    #50672
    Daniel Leu
    Participant

    You can assign a ‘Menu Shortcut’ for a script. This way, you can start it with a keyboard shortcut like cmd-k. You find this in the script options.

    Attachments:
    You must be logged in to view attached files.

    Cheers, Daniel

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

    #50660
    Daniel Leu
    Participant

    Are all your entries in the “1723-1756” format? If yes, you could split it into two integer fields. Then in the Saved Search, you can use comparison to find if a record matches the year in question.

    I assume that you already have many records and splitting the format is not really feasible and it doesn’t look aesthetically pleasing. But you can use two field scripts that do the work for you:

    function Year_X(num) {
    
    var year_period = record.getFieldValue('fld-xxx');
    
    return year_period.split('-')[num];
    
    }
    
    Year_X(0);

    <p class=”p1″>
    You would need to change fld-xxx to the field value of your year string.</p>
    For the start year, you use the code from above and for the end string you do the same and use Year_X(1) in the last line.

    By using this script fields, we could even enhance it a bit more to support cases where you have the year instead of the year range.

    Hope this helps.

    • This reply was modified 1 year, 7 months ago by Daniel Leu.

    Cheers, Daniel

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

Viewing 15 results - 331 through 345 (of 2,950 total)