Blog  |  Support  |  Forums

Search Results for 'script'

Viewing 15 results - 1 through 15 (of 2,610 total)
  • Author
    Search Results
  • #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).

    #50688
    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.
    #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 4 weeks, 1 day ago by Daniel Leu.
    #50650
    Brendan
    Keymaster

    Hi Hannes,

    There are two types of scripts. Field scripts and Form scripts. Field scripts run automatically when a field referenced inside the script using the record.getFieldValue(field_id); function is executed. Tap Forms also saves to the database whenever you exit a field. Although if you run a script that changes things, you’ll also want to call form.saveAllChanges();

    So there’s no need to have a trigger to run a script when things are saved because with Field Scripts it happens automatically.

    Form scripts must be run manually by you.

    Thanks,

    Brendan

    #50647
    Hannes keller
    Participant

    Hi Everyone,

    I am new to Tapforms and experimenting right now with JavaScript. Is there an option to run a Script automatically during the “normal” saving process?

    Thanks for your Help.

    Hannes

    #50620
    Fernando DS
    Participant

    Hi Brendan,

    It is a form script. I have done what you have told me and this has made it very much easier for me to print listings.

    Thank you very much.

    #50618
    Brendan
    Keymaster

    Hi Fernando,

    Is this a Field script or a Form script?

    If it’s a Field script, then the results returned from the script can be printed directly with the rest of the fields in the record.

    If it’s a Form script, you’d need to write the results into another field, such as a Text field. Then you can print the contents of that field.

    Thanks,

    Brendan

    #50613
    Fernando DS
    Participant

    I would like to know if this will be possible sometime. Now I have to copy lists and paste them on another app. It would be better can print directly.
    thank you.

     

    #50606
    Victor Warner
    Participant

    I am trying to learn to use loops in JavaScript combined with a saved search. I have been able to create a script that can obtain the required data from fields in records found by a saved search. However, I cannot write some data to a field for the records found by a saved search.

    Could I have some help in identifying what is wrong or what needs adding. The sample database is attached.

    
    
    // Fields
    var date_id = 'fld-93ed9225fc674e7c840266726e160538';
    var first_name_id = 'fld-edfdac34b4de4df79e5aced3c3ddc9be';
    var completed_id = 'fld-6a9df78c9df744e292f47e11077d3d6d';
    var client_name_id = 'fld-ec4fb9b85cb54d52813a9cd69c08198f';
    
    // Push variable
    
    var txt = [];
    
    // Getting saved search
    var saved_search = form.getSearchNamed('Completed');
    
    // get the records for the saved search
    var dupes_search = saved_search.getRecords();
    
    // Looping through the records for the saved search
    for (var index = 0, count = dupes_search.length; index < count; index++){
    var dupes_search_details = dupes_search[index];
    
    // getting the contents of fields
    var completed = dupes_search_details.getFieldValue(completed_id);
    var client_name = dupes_search_details.getFieldValue(client_name_id);
    
    // writing data to fields
    dupes_search_details.setFieldValue(first_name_id, "Johnny");
    //dupes_search_details.setFieldValue(date_id, "2024-03-06");
    
    // putting data from fields together
    txt.push((index+1) + ". " + client_name + " = " + completed + ", and the count of records found by saved search: " + count + "\n");
    
    }
    
    txt.join();
    
    console.log(txt);
    
    Attachments:
    You must be logged in to view attached files.
    #50604
    Brendan
    Keymaster

    It won’t automatically open. You can just have it opened. Then whenever you call console.log("some data"); it will display the contents. So when you view a record, then you can just run the script and it’ll dump out the contents into the console window.

    #50597
    Brendan
    Keymaster

    Hi Paul,

    One option would be to use a Form script instead and then click the button to run the script or setup a shortcut to run the script and have the Console window open where you can dump the content to.

    Paul Wirth
    Participant

    I have a script that concatenates a bunch of linked records as text and inserts the concatenated text into a field, so that I can easily scroll through a bunch of entries at once.

    Currently, the script runs any time a linked field is updated, so every record has concatenated text stored in its designated field. But I don’t really need that text stored, since it’s redundant. It’s just useful to browse through the text when needed.

    What would work nicely is if there was a script command to produce a modal or popover for viewing scrollable text that can be dismissed. The idea is that this would be ephemeral. Click a button to run the script, which concatenates the field and displays the full text for viewing, but doesn’t store it to the file.

    The Prompter() class would work, except any text beyond a few lines is cut off and not scrollable.

    Maybe this is such a unique request that it isn’t worth developing, but I thought I’d ask!

    #50576
    FrAnksch
    Participant

    Daniel, thank you very much.
    Since I’m a script newbie, I had a problem to set this “isRecord” property, but now after several trials, I finally figured it out.

    one additional question:

    With my script below, I mark the current entry of my dairy (“today’s record”) greenish and as favorite.
    Therefor I use a “helper calculation field” (tageseit) that calculates the difference between date of record and today (>>DAYS(X;Y)<<),  which then is checked in an if query.
    This is working as expected, but how can I get this calculation (of entire days) done in the script? If I calculate with date fields, I get “seconds” as result, not entire days.

    Thanks for your help!

    my Script:

    function SkriptMarkToday() {

    var tageseit_id = ‘fld-6826c8b388e046c5ab5b10144fe499db’;
    var tageseit = record.getFieldValue(tageseit_id);
    var forcefav_id = ‘fld-aa6d11f990724703969cd07d85037f71’;
    var forcefav = record.getFieldValue(forcefav_id);

    form.selectRecord();

    if (tageseit == 0) {
    record.setRecordColor(“#66DD77”);
    record.isFavourite=1;
    console.log(“als heute und als FAV markiert”);

    } else {
    if (forcefav == 0) {
    record.isFavourite=0;
    console.log(“FAV deaktiviert”)
    }
    record.setRecordColor(null);
    console.log(“nicht heute”);
    }
    form.saveAllChanges();

    }

    SkriptMarkToday();

    • This reply was modified 1 month, 3 weeks ago by FrAnksch. Reason: Tried to format the code - don't know how
    • This reply was modified 1 month, 3 weeks ago by FrAnksch.
Viewing 15 results - 1 through 15 (of 2,610 total)
 
Apple, the Apple logo, iPad, iPhone, and iPod touch are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc.