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,036 through 1,050 (of 3,102 total)
  • Author
    Search Results
  • #47070
    Bernie McGuire
    Participant

    This is such a basic question, Im sure it’s been asked but I can not find the answer.
    For Example Main Form is a Customer
    Linke form is list of orders

    I want to show the latest order date, from the order form , on the Parent Customer Form. So I can see it on the Record list for the Customers.

    Oh, yes. I am using a JOIN relationship which is working perfectly.

    I can not find a way to get the ‘MAX’ date in a Calculated field. I prefer to not use scripting .

    I am using IOS (I do have Mac also)

    Please any help is appreciated.
    THanks Bernie

    #47059
    Brendan
    Keymaster

    Hi Juan,

    This does not require a script for that (since you posted in the Script Talk forum). You can just go to the Options tab on the Print panel and turn off the date, time and page number options.

    Thanks!

    Brendan

    #47050
    Sam Moffatt
    Participant

    I forget that dealing with dates in JS is so weird at times, I went looking and found a decent looking strftime port and threw it in my script manager repo as well.

    #47030

    In reply to: Help with a script

    Stig Widell
    Participant

    Sam again,
    After having explored a bit further, this is the situation:
    The script Kalva works fine with 2 of the breeding bulls (1 & 4)
    It doesnt work with 3 (the rest) of the breeding bulls (1, 3 & 5)
    I then get the message in MAC “Varning Det gick inte att hitta posten!”
    I cant figure out why some bulls work and not the others.

    #47027

    In reply to: Help with a script

    Stig Widell
    Participant

    Sam The problem is not the non parity.
    The problem is that fader-ID is not shown after running the script Kalva.

    #47022

    In reply to: Help with a script

    Stig Widell
    Participant

    The message “Script is run complete” I received in IOS.
    When running in Mac I received “Fel! Sätta grupprekordet”

    #47020

    In reply to: Help with a script

    Stig Widell
    Participant

    Hi again,
    The script Kalva, created by Sam Moffatt, worked very well a couple of weeks ago.
    Now when I have to use it because calves are started coming the calfs father in the form Kalvningar is not shown.
    I get “Script is run complete” instead of “Gjord”
    Enclose template.
    Sorry about this.
    Stig

    Attachments:
    You must be logged in to view attached files.
    #47014
    Daniel Leu
    Participant

    Javascript date handling is a bit confusing:

    The getDay() method returns the day of the week for the specified date according to local time, where 0 represents Sunday.

    The getMonth() method returns the month in the specified date according to local time, as a zero-based value (where zero indicates the first month of the year).

    What you want to use is something like this:

    var drDay = sessionDate.getDate();
    var drMonth = sessionDate.getMonth() + 1;
    var drYear = sessionDate.getFullYear();
    • This reply was modified 4 years, 3 months ago by Daniel Leu.

    Cheers, Daniel

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

    #47004
    Ricard Casals
    Participant

    Brendan, I reviewed the script I had and the file’s url and now everything works! – Something a small thing that wasn’t ok: a space in the url?, not enabled TF5 script folder preference? I have to be very careful about these little details in the code and the data it carries!
    Thanks again for your patience and dedication!
    By the way, the last line “document.saveAllChanges ();” is equivalent to “form.saveAllChanges ();”?
    Ricard

    #46996
    Brendan
    Keymaster

    Hi Gary,

    Yes there is.

    What you want to do is make a Form Script that you run at the time you select the previous record and have the script make the new record for you and then copy all the values over to the new record from the selected record and then have Tap Forms select the new record.

    On the Template Exchange forum there’s a Mileage Tracker form I posted which does exactly this.

    Mileage Tracker (Tap Forms 5.3)

    So basically you’re defining what the previous record is by first selecting it. Then when the script runs, it gets that data and copies it to the new record. Now you can modify the new record any way you like. You don’t need to first make a new record by clicking the + button. Just select the old record and run the script.

    Hope that makes sense.

    Thanks,

    Brendan

    • This reply was modified 4 years, 3 months ago by Brendan.
    #46995
    Brendan
    Keymaster

    So Daniel emailed me about this thread. Sorry I missed it before.

    At first I thought, damn, my code isn’t working.

    But then when I dug into it more, it turns out it is working.

    There are a couple of things you need to do though.

    1. Make sure the source files you want to make aliases for are accessible to the Scripting engine by setting the Script Folder on the Preferences window. Without this, Tap Forms won’t be able to read the file for it to make a bookmark/alias for.

    2. Make sure you URL encode the URL string you’re trying to make an alias for. The only problem with this is you’ll get the encoding in the filename on the File Attachments field.

    I’ve just added code to URL encode the provided URL and that avoids that problem. But either will work then.

    Here’s a sample that worked for me in the existing version:

    function Add_Alias() {
    
    	var file_attachment_id = 'fld-36eea6e880d14959b2e002b8f9b060b8';
    	var url = "file:///Users/brendan/Desktop/All%20Wines.csv";
    	record.addFileFromUrlToField(url, file_attachment_id, {"alias" : true});
    	document.saveAllChanges();
    }
    
    Add_Alias();

    and when I release the next update, this will work:

    function Add_Alias() {
    
    	var file_attachment_id = 'fld-36eea6e880d14959b2e002b8f9b060b8';
    	var url = "file:///Users/brendan/Desktop/All Wines.csv";
    	record.addFileFromUrlToField(url, file_attachment_id, {"alias" : true});
    	document.saveAllChanges();
    }
    
    Add_Alias();

    Only the All Wines.csv file is different. But if your files don’t have any spaces or special characters in them, then you should be fine as is.

    Thanks,

    Brendan

    #46988

    In reply to: Script on a Field

    Daniel Leu
    Participant

    I added a dummy var number = record.getFieldValue(field2_id); and now the field script gets executed upon a value change.

    Cheers, Daniel

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

    #46987

    In reply to: Script on a Field

    Bernie McGuire
    Participant

    My script.
    function Total1() {

    var field2_id = ‘fld-1e5045dd497f4359a0a98b5bbc010059’;

    var total = form.getTotalOfField(field2_id);
    var total2_id = ‘fld-737e46579abc42b0a42dafb6f06b0bf8’;
    record.setFieldValue(total2_id,total);;
    form.saveAllChanges();
    document.saveAllChanges();
    return total;

    }

    Total1();

    #46986

    In reply to: Script on a Field

    Daniel Leu
    Participant

    Maybe sharing your script?

    Cheers, Daniel

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

    #46984

    In reply to: Script on a Field

    Daniel Leu
    Participant

    It looks like your script is not triggered. This might be due to using field.getId(). I would try this: in the script editor, click on the icon between ‘fx’ and ‘ABC’, select field_id, then click on your variable. This will provide you with the id definition that Tf uses to determine when to trigger a field script.

    Hope this helps!

    Cheers, Daniel

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

Viewing 15 results - 1,036 through 1,050 (of 3,102 total)