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 - 451 through 465 (of 2,989 total)
  • Author
    Search Results
  • #50213
    Brendan
    Keymaster

    Hi Kathy,

    One possibility for you instead of having all the fields from the link to form appearing there, click the little tool button that looks kind of like an X at the top-right of the table view. From there you can select and de-select the fields you want to see. Plus you can also drag the fields up and down and that will change the order they display on the horizontal table view for the Link to Form field.

    Give that a try and see how it works for you.

    If you need something other than that, you’ll need to write a script that pulls out the data from the child form to display it on the parent form.

    Thanks,

    Brendan

    #50208
    Brendan
    Keymaster

    You could write a Script you could run that takes the shopping list values and adds them to the Reminders.

    function Add_And_Update_Reminder() {
    // Create new Date instance
    var due_date = new Date();
    
    // Add a day
    due_date.setDate(due_date.getDate() + 1);
    var event_info = {"list_name" : "Work",
    "title" : "Test Event",
    "priority" : 1,
    "notes" : "test note",
    "repeat_option" : 2};
    
    var identifier = Utils.addToReminders(event_info, due_date);
    console.log(identifier);
    event_info["title"] = "Hello Reminder 2";
    Utils.updateReminder(identifier, event_info, due_date);
    }
    
    Add_And_Update_Reminder();
    • This reply was modified 2 years, 1 month ago by Brendan.
    #50205
    Brendan
    Keymaster

    Hi,

    If you setup your Recipes form with a relationship to an Ingredients form, then you could select some recipes to print to make a PDF file that you could browse while you’re shopping. Not exactly an interactive experience though like you might get from a dedicated shopping / recipes app. But it would be possible.

    Another way might be to write a Form script that lets you select specific recipes and then inserts the ingredients for those recipes into another form that contains your shopping list items. This would be an involved script to write though.

     

    #50176
    Fernando DS
    Participant

    At last this is the script that works:

    function modifyFieldsBasedOnCondition() {
    var fieldId1 = ‘fld-28b97ce8ab4f4f57a83aefa7e91f17fe’;
    var fieldId2 = ‘fld-c2fd26ae62c1445692b3a0abc1e89158’;

    for (var record of form.getRecords()) {
    var valueField1 = record.getFieldValue(fieldId1);
    var valueField2 = record.getFieldValue(fieldId2);

    if (valueField1 === 4 && (valueField2 === null || valueField2 === “”)) {
    record.setFieldValue(fieldId2, “Buen disco.”);
    console.log(“Campo fieldid2 actualizado en el registro con campo fieldid1 igual a 4 y fieldid2 vacío.”);
    }
    }

    form.saveAllChanges();
    }

    modifyFieldsBasedOnCondition();

     

    Thank you Brendan and Daniel for your valuable help.

    Bye.

     

    #50153
    Fernando DS
    Participant

    Hi Brendan, thank you for your answer. The script is steel not working.

    Attachments:
    You must be logged in to view attached files.
    #50150
    Fernando DS
    Participant

    Hi. I want to do an script for autocomplete a note field called “Comentario” with “Buen disco.”, when the valoration field “Valoración” has four stars and, at once, the field “Comentario” is empty. I have not errors in the console, but the script does not work. Any help will be welcome. Thank you.

     

    Attachments:
    You must be logged in to view attached files.
    #50143
    Glen Forister
    Participant

    I just did:
    Copy New Form to another experimenting Form.
    Then imported the data file into it and ended up with just 3 records which were only the added record and the 2 changed records.

    Where are all the other records.  And, the calculations (not JavaScript) don’t work, but the names of the fields in the calculations are right.  Do they have to be redefined?

    This is ridiculously problematic.  I never had any trouble like this in HanDBase when wanting to do this.

    #50142
    Glen Forister
    Participant

    I may have missed something.  I had exported in TAB but the file is .csv, so I think I chose that item.

    The import did happen, but now instead of a few added records, the records doubled.  Oops, now I have every record with it’s copy.

    How do I prevent doubling the records, and just update the records that are there?

    I guess I’ll save my new Form with the added fields and JavaScript into a Form Template file and start a new Form using the template and import the records to get to where I want to be?

    Question:  If I need to work on the new form some more, how do I update the records from the original working Form into the new Form without doubling it again?

    #50137
    Glen Forister
    Participant

    I finally had the time to do the

    Copy Form to a new Form in the same document.
    I then made my changes in the copied Form and added 2 fields to hold the Java Scripts.

    I then Exported my revised data in the original Form into a CSV file.
    I also had to rename a couple fields when I imported into a spreadsheet.
    I also had to the delete the data in one field so the Javascript could work properly.

    I then imported the altered CSV file into the new copied Form with the desired Form changes.
    Unfortunately, the changes didn’t happen and the added records didn’t get imported even thought the feedback and temperature graphic showed it was happening.

    Basically nothing happened and the new Form didn’t get updated.

    What is the correct process if it isn’t the one detailed below in a previous posting?

    =======  Process determined in an earlier posting  ================================

    Ok, so really, the only safe way to create a copy to work on changing the Original Form, is:

    1. Duplicate the Form.

    2. Work on the changes wanted, including renaming fields, moving fields, adding fields and all the changes in properties required in the Duplicate Form.

    3. Export data as a CSV file from the Original Form which you are still adding data to while work on the Duplicate Form was proceeding.  Make sure the Export Record IDs option is turned OFF. If you don’t, Tap Forms will just update the existing records when you re-import the CSV file.

    4. Import that data from the Original Form into the new Duplicate Form.

    5.  During the Import process, make sure the data in the old Form is directed to the correct field in the Duplicate Form.  I haven’t done this much in TF, so I don’t know how much ability there is to make sure the previous is possible, but I’m sure you made that possible.

    Thanks for clarifying the traps involved with the Archive file.  Basically, don’t use it for this purpose or it will prove dangerous to you eventually.

    Let me know if I’m correct or need to change something.

    #50130

    Topic: Attach PDF

    Glen Forister
    Participant

    I see how to attach a picture, but can I attach a PDF anywhere?  I don’t see any mention in the descriptions of the fields.

    Is the solution to convert PDFs to pictures?

    #50117

    In reply to: testing scripts

    Glen Forister
    Participant

    I finally had the time to do the

    Copy Form to a new Form in the same document.
    I then made my changes in the copied Form and added 2 fields to hold the Java Scripts.

    I then Exported my revised data in the original Form into a CSV file.
    I also had to rename a couple fields when I imported into a spreadsheet.
    I also had to the data in one field.

    I then imported the altered CSV file into the new copied Form with the desired changes.
    Unfortunately, the changes didn’t happen and the added records didn’t get imported.

    Basically nothing happened and the new Form didn’t get updated.

    What is the correct process if it isn’t the one detailed above in the previous posting.

    #50116
    Glen Forister
    Participant

    You define “Note” field = large amounts of text. .

    You define “Text” field = movie title or short description.

    I imported from another DB as CSV file and notice that some records in the “Text” field contain a fair amount of text, much more than “movie title or short description”.

    I wonder how many characters a Text field can contain before it doesn’t work anymore.   So, should I convert many of my Text fields to Note fields because they have much more than “short description”?

    The downside of using the Note field a lot where a Text field would suffice would increase the size of the database considerably I would assume.  So, the question about how many characters is a valid question and an important one.  Other databases do define this information in character numbers allowed before it is chopped off.

    #50104

    In reply to: Javascript Help

    Daniel Leu
    Participant

    In my case, the checkbox field is called ‘selected’. You just need to assign the field id of field Added_to_VR-Mailing on line 3 of the code below.

    // This script selects all records
    
    function selectAll(){
    const selected_id = 'fld-xxxx';
    var records = form.getRecords();
    
    for (var index = 0, count = records.length; index < count; index++){
    var myRec = records[index];
    myRec.setFieldValue(selected_id, true);
    }
    
    document.saveAllChanges();
    }
    
    selectAll();

    The code loops over all records and sets the checkbox value to true.

    • This reply was modified 2 years, 2 months ago by Daniel Leu.
    • This reply was modified 2 years, 2 months ago by Daniel Leu.
    • This reply was modified 2 years, 2 months ago by Daniel Leu.

    Cheers, Daniel

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

    #50103

    Topic: Javascript Help

    in forum Script Talk
    Peter Chamalian
    Participant

    I have a form with a simple checkbox.  I want to start by checking that box for all my records.  Not being a Javascript coder, I need some help.

    The field name to check is Added_to_VR-Mailing.

     

    Thanks!!

    #50088
    Brendan
    Keymaster

    Hi David,

    I was just playing around with writing a script for you, but then realized that it wouldn’t work. When you add a photo to a record in Tap Forms, the data is stored in two places for the photo. The record holds a dictionary with the photo field’s metadata, including the filename. But also, the record’s internal representation in the CouchbaseLite database holds a reference to that photo too. It uses the filename to hold that reference. So if you rename the value in the photo field’s metadata for the specified photo, it will no longer match the photo referenced in the record’s internal representation of attachment data in the CouchbaseLite database.

    In my testing when I renamed the photo from JavaScript, it was not able to also rename the record’s attachments data, so it effectively removed the photo from display.

    So at the moment, there’s no function to rename a photo from JavaScript.

    Thanks,

    Brendan

Viewing 15 results - 451 through 465 (of 2,989 total)