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,966 through 1,980 (of 2,989 total)
  • Author
    Search Results
  • #40324
    Brendan
    Keymaster

    Hello Wilma,

    I’m glad that you’re enjoying Tap Forms!

    I would recommend switching the Field Type of your Description field to be a Note field instead of a Text field. You’ll get a much larger area to view and edit the values then.

    You’ll get a warning when switching the field type from Text to Note, but it’s ok. Your data will display just fine after the switch because Note and Text fields are compatible. They just display and edit differently.

    Thanks!

    Brendan

    #40319
    Wilma
    Participant

    Hello all, after my beloved Bento gave up a couple of weeks ago, I switched to TapForms and I’m not disappointed. In fact, I’m so pleased with it that I deleted Bento altogether and I can also trash the old MacBook I kept around just for the purpose of the one Bento database that I cherish :-)

    Importing the Bento data was very easy and without a glitch and pretty quickly found my way around Tap Forms to customise a form. Synching to my iPad works like a dream (except for today, perhaps the update?) but I have one question: my movie database has a large “description” (text) field but on the iPad I can only see a very limited part of this description: the beginning of it and when I tap on it, it shows me the last bit of the description. There’s no pop-up or fly-out field on the iPad to show the entire description. The description is restricted to the one-line box.

    Am I missing something? Is there a way to see the entire description on my iPad also?

    #40311

    In reply to: Global Variables

    Daniel Leu
    Participant

    Here is something I’m working on: https://api.danielleu.com/public/tf5/v1/files/configHandler-v1.js

    I use a form where I store variables that can be used by different forms and their scripts. To use it in a calculation field, you would need to add a field script that just returns the global variable. Then in your calculation, you can reference this field.

    No idea about what and how to go about your wanted usage of variable in Notes and Photos. This might be something for a form script.

    Cheers, Daniel

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

    #40305
    iorbita
    Participant

    …thank you very much Sam, I really appreciate the time you have spent to explain me your script, I’m going to analyze it, try to understand it and reproduce what you explained in a new TapForms file in order to link a form to table.

    Thank you again Sam ;)

    Lorenzo

    #40303
    Alejandro
    Participant

    Hi Sam!
    Thank you! I’m looking for all your scripts at GitHub and are great to learn a lot!

    #40301
    Sam Moffatt
    Participant

    Neat! That’s a similar concept to a form logger script I wrote a while back. The latest version on GitHub includes a mode that outputs the script fields as Javascript variables prefixed by form name to ensure that your fields across multiple forms aren’t confusingly duplicated. I copy the output of the console log for this script to a new form script called “All Fields” which I can reference everywhere and use the same variables.

    Paolo Sogono
    Participant

    Thanks for replying Brendan.

    I’m absolutely new to Javascript. Is it alright if you upload an example working database which uses the child records loop snippet?

    #40299
    Brendan
    Keymaster

    Hi Paulo,

    You can do this with the Child Records Loop snippet that’s available to you.

    Just select your Price field from your Table field on the Script Edit window, then double-click on the Child Records Loop snippet at the bottom-left.

    Tap Forms will write you a function which loops through the records of the Table field. You can then enhance it to pick out other fields too.

    Thanks!

    Brendan

    #40298
    Alejandro
    Participant

    Hi Sam! Thank You! I added your script to the Brendan’s script and I’ve got a new idea.

    Bu the way, I add this script that helps me to get the Fld_Ids:

    function Get_Flds() {

    var records = form.getFields();

    for (var index = 0, count = records.length; index < count; index++) {
    var theRec = records[index];
    var fld_id = theRec.getId();
    var name_id = form.getFieldWithId(fld_id).name;

    console.log(‘FieldName: ‘ + name_id + ‘\n’ + ‘ fld_ID: ‘ + fld_id + ‘\n\n’);

    }
    }

    Get_Flds();

    Paolo Sogono
    Participant

    Hi Everyone,

    I pretty new to TF5 and scripts. I hope someone can help my with my concern.

    I would like assistance in making a summary field that enumerates individual items from a Table Field.

    Form 1: Customers
    Fields: Name, Age

    Form 2: Products
    Fields: Name of product, description, instructions

    Form 3: Orders
    Fields: Customer(link from Form), Date of purchase, Product (Table Fields copy records from Products)

    E.g. John Doe, orders the ff items: a) A4, b) pencils, c) erasers on 2 April 2020.

    In the Orders Form these are displayed separately in rows in the Product Table (with corresponding price and description)

    I want to have a separate summary field in the Orders Form that will output the ff: “A4, pencils, erasers.”

    Example 2:
    Orders are
    1. A4, 500pcs, $10
    2. pencils, 1pc, $0.5
    3. A4, 500pcs, $10
    4. ballpen, 1pc, $1

    Output is “A4, pencil A4, ballpen.”

    I’m not sure if I was able to explain it clearly. Any help would be appreciated.

    #40295
    Sam Moffatt
    Participant

    Do you mean the customer name, phone and address details?

    I’d create a form script, inside the script editor you are going to be able to double click on the left to grab the Customers form (section header) and then double click on the fields you care about from that form (name, phone and address I guess).

    Next step is then double clicking on the notes field to get it’s current value. Then you’re going to want to append to it (presumably). To do that you’re going to want to combine the existing value with a new one.

    var notes = record.getFieldValue('fld-1234');
    record.setFieldValue('fld-1234', notes + "\n" + name + "; " + phone + "; " + address);
    form.saveAllChanges();
    

    Something like that will take the values from the name, phone and address field (assuming the variables ended up that way) and will add them to the existing notes field with a new line prepended. You need the form.saveAllChanges(); to make sure your changes are saved.

    #40292
    Sam Moffatt
    Participant

    This one isn’t too bad to get started on, when ever anyone has told me they want to learn programming my first question is what is the project or problem they want to solve. You’ve already got a small problem to solve which is a great place to start. I will suggest if possible maybe switching over from table to a link to form if you don’t have too much data because I know the link to form works but the table I haven’t used as much. Apart from having an extra form, it can behave more or less identically.

    Just to expand on the script, let me go line by line since it’s a relatively small script. This is a script field inside the new form and make sure you set up a Link to Form field from the existing form to your new form and also make sure the Link to Form field has ‘show inverse relationship’ ticked.

    var order = record.getFieldValue('fld-c3a6725d7d9446da92bbb880ffe90a9e');
    

    This first line is there to get a reference to the parent record (your current form right now). This is the piece I’m not so certain about how you get in the table field hence the suggestion to use a new form and Link to Form/Link from Form. In my case I have an Order form and then an Order Items form. For your situation you’ll need to change the fld-c3a6725d7d9446da92bbb880ffe90a9e to match the Link From Form field. To do that in the script editor for the script field, double click on the form header in the left panel.

    var order_items = order.getFieldValue('fld-9db0c7698499435ab6b18b7eb420e0ae');
    

    This is the Link To Form field and to get the value of this you’ll need to be in the equivalent of your Orders form (your current parent form). If you don’t have an existing script field to use, I generally create a new form script (third tab on the right panel), open up the editor and then get the ID I need. In this case you’re looking for the section heading with the name of your new form, in my case ‘Order Item’ and double click on that to get field ID to splice in above.

    In this situation, order_items returns a set of records linked to the parent record via the field. This essentially is all of the sibling records of the currently selected record.

    var line_number = record.getFieldValue('fld-f95b68d488cb4b058bbf3de84e1a7c3b');
    

    This is the new field in the new form that stores essentially your offsets. You can get this in the script editor by double clicking on the field name and it should insert this or a similar line with the correct field ID.

    if (!line_number)
    {
    

    This is a check to see if the line_number is not set on this record already. This just makes sure once it has a value set, it doesn’t overwrite it again.

    	record.setFieldValue('fld-f95b68d488cb4b058bbf3de84e1a7c3b', order_items.length);
    

    This line sets the value of the line_number field (notice the ID is the same) to the number of records currently linked to the parent (order_items.length). When this is working properly, each time a new record is created, the number of items will be incremented automatically. It’s not 100% perfect but it’s a good enough approximation that doesn’t require scanning all records to find the current maximum and set it to be higher than that.

    	console.log('Setting line number to ' + order_items.length);
    }
    

    I like lots of logging and I put in a log message just to see what is going on and we need to close out the if statement block hence the }.

    Hopefully this helps, a little more detail on what this script means and how to make it happen for yourself. Again I recommend switching over to a second form and a Link to Form field because I’m not sure how well this works with table fields.

    Good luck! Scripting in Tap Forms unlocks a large number of capabilities and gives you a large amount of power to customise your workflows.

    #40291
    Alejandro
    Participant

    Hi! I’m starting to use script in Tap Forms 5.
    Perhaps someone can help me with this. I think is easy but I’m stuck.

    Scenario: I have two forms that are related with the link to form option in a one to many way.

    Form Customers:
    Fields: Name, Phone, Address, Tickets (Link to Form)

    Form Tickets:
    Fields: Customers (Link From Form), Subject, Date, Resolve, Notes

    I want to run a script to add the value I see in Form(Tickets)->Customers to Form(Tickets)->Notes.

    Thank you!

    #40290
    iorbita
    Participant

    …the world of scripting and therefore programming is not yet part of my skills, I started to learn javascript recently, it will be a good exercise, thank you anyway ;)

    Lorenzo

    #40289

    In reply to: User calculation

    Brendan
    Keymaster

    Ah yes. That was just a variable scope issue for you.

    If you had just moved the var definitions above function Nieuw_Script(), it would have worked too.

Viewing 15 results - 1,966 through 1,980 (of 2,989 total)