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 - 901 through 915 (of 3,053 total)
  • Author
    Search Results
  • #47631

    In reply to: Date issue

    Stig Widell
    Participant

    Is it the case: that a date field created by a script cannot be used in a calculation field for the creation of a new date?

    #47602
    Brendan
    Keymaster

    Hi ang,

    As Daniel mentioned in his response above, you need a record. You don’t have a record in your script. You’re attempting to get a value from a form. A form has no values. It does have records though. And records have values for the fields in the form.

    So you need to modify your code to either use the currently selected record by using the record keyword, or get all of the records from the form you’ve assigned to your variable and loop through them to get the values you want.

    JScottA
    Participant

    Hey guys. Maybe you can speed up my work a little. I have about 100 csv files that I want to import into one form. They are not large files, but currently I think have to manually import each one. I was hoping to be able to select all of the files and Tap Forms would just import one after another. I looked for Shortcuts, Automator, and AppleScript support for doing this, but I didn’t see anything obvious. Do you guys have any brilliant suggestions?

    Thank you for taking a look at this.

    #47597

    In reply to: 1 to 1 Relationship

    Brendan
    Keymaster

    Hi Bernie,

    I moved your posting to the Using Tap Forms forum because your question doesn’t have anything to do with scripting.

    Tap Forms does not support a one-to-one relationship. It has One to Many, Many to Many, and Join.

    The iOS version doesn’t yet support the Access Controls function, which I think you’re referring to .

    Thanks,

    Brendan

    #47588
    Lars Mathiasen
    Participant

    Hello. I am new to TF. I have made a training app using iCloud for DB sync. Now I want to migrate it to a cloud solution like IBM or Apache DB. However, I do not get how to manage users in TF and external DB’s. Are there some man-pages or some videos on the topic so users can have private forms and share forms like premade information?

    My model is to have users add them-selves on a logon/register page I make in HTML. They buy TF for iOS and get access to training descriptions, recipes and training log.

    #47581

    Topic: Date issue

    in forum Script Talk
    Stig Widell
    Participant

    Hi,
    In the form “Rekryteringsdjur” I have the field “Senaste kalvning, datum” (latest calving date)
    which is created by a script.
    Now I tried to add a new calculation field “… och betäckt, datum” (pregnancy date) but it works for some cows only and not for others and in the iphone it doesnt work at all.
    Need help!

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

    In reply to: Feature or Fluke?

    Daniel Leu
    Participant

    I use this whenever I need a function from my ‘script library’. I don’t care if the script is called several times. But I protect the content of these library scripts so they are not executed more than once. Here is the example of my Common script:

    // Only define functions once and skip them when already called
    if (typeof commonScript === undefined){
    	var commonScript = 1;
    
    // here go your function definitions
    
    }

    Obviously there is a performance penalty when you have many script fields that use this include and you do a refresh of *all* records.

    But yeah, sometimes it is a challenge to get a field script trigger upon a field change… I run into this as well… I usually try to have all field defines at the top of the script:

    var fldName = 'fld-xxx'
    ...

    And then in the script I just use these defined variables or constants.

    Hope this helps!

    Cheers, Daniel

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

    #47533

    In reply to: Feature or Fluke?

    Bernie McGuire
    Participant

    Daniel, This is a great idea. A question , when you say “Then in the field script, I use document.getFormNamed ..” You put this in the first field script on the other forms so they can execute the functions in ‘Common’, correct?

    Do you get this first field scrip to execute automatically (by watchin a field on the form) ? or does your user have to do ‘refresh’ to get things started? I am having a very hard time getting a script to run automatically, based on a field change, I have dried a dozen ways. I need to have the user hit ‘refresh’ How do you do it ?

    Thanks for you help
    Bernie

    #47528

    In reply to: Feature or Fluke?

    Daniel Leu
    Participant

    I usually create a form named Scripts and place all javascript functions in form scripts (eg, Common). I try to organize them logically so I can easily reuse them. Then in the field script, I use document.getFormNamed('Scripts').runScriptNamed('Common'); to load one (or several) of these form scripts. Later I can execute whatever function I need.

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

    Cheers, Daniel

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

    #47524

    Topic: Feature or Fluke?

    in forum Script Talk
    Bernie McGuire
    Participant

    I have a situation which I don’t know if it works because of TF design or just happens to work now and maybe will not in the future.

    I have a ‘Result’ field , on a ‘Entry Form’ , that can have 17 different values. I use a pick list to have the operator populate the field.

    On the ‘Totals’ form I want to show a count (and percentage) of each result value. So I have a script that will loop througe the records on the linked ‘Entry Forms’ and count the ‘Results’. This script function takes an input parmater containe the ‘Result’ value I want a total for and return the appropiate value.

    So rather than duplicating the script in 17 different total fields I placed the script (named CountResults) in the FIRST field on the Totals form, and then for the other 16 i just execute ‘CountResult(‘xxx’)

    This only seems to work if the script (CountResults) is in the first field on the totals form.

    So, is this a feature I can rely on now and in future releases, or not?
    (I understand the risks if the script field changed location, etc.

    Thansk
    Bernie

    #47509
    ang
    Participant

    Hello,

    I’m trying to display the value of a specific field value from a linked parent form (many to many).
    Name of the parent form : “structures_19_06”
    Field ID value to display : “fld-33b8d7ca30f54c7f8e9974030ea1b3f0”

    In script, i have added the field like this :

    function Structure_Diffuseur_1() {
    var nom_de_structure = structures_19_06[index].getFieldValue(‘fld-33b8d7ca30f54c7f8e9974030ea1b3f0’);
    }
    Structure_Diffuseur_1()

    It returns thos error :
    Structure (DIFFUSEUR) 1: ReferenceError: Can’t find variable: structures_19_06, line:(null)

    Can you help me to correct this ?
    Thank you very much

    #47481
    David Schwane
    Participant

    one last related question. I notice if I refresh all records, the script is getting fired and incrementing the field by 1 each time. Is there a way to bypass the script trigger from record refresh?

    #47474
    Daniel Leu
    Participant

    Something like this:

    const fieldWebSite = 'fld-...'
    const fieldWebSiteClean = 'fld-...'
    
    var web_site = record.getFieldValue(fieldWebSite);
    var new_web_site = web_site.split('?')[0];
    record.setFieldValue(fieldWebSiteClean, new_web_site);

    Re Times Used:
    I’m not certain that this works, but I think to remember that the field trigger code parses the script for fld-... patterns. So when using const fieldTimesUsed = form.getFieldNamed('Times Used').getId(), you might avoid the trigger. Certainly @Brendan will chime in on this.

    Cheers, Daniel

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

    #47470
    Daniel Leu
    Participant

    Yeah, the script is triggered again if you update it with your script. In situations like this, I use two fields, one with the raw data and one with the processed data.

    Cheers, Daniel

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

    #47468
    David Schwane
    Participant

    Thank you and I understood that is the current mechanic, but for me, the script fires twice because I suppose I’m changing the field that I’m watching. While this looping doesn’t cause an issue with this example, I have some other situations where the script firing twice is problematic.

    Example attached.
    import
    open console
    copy into website field a URL with query string, i.e https://example.com/movies?si=zyH0Aqaaa

    console shows
    Script Excecuted 6/8/2022, 7:32:50 PM for https://example.com/movies
    Script Excecuted 6/8/2022, 7:32:50 PM for https://example.com/movies

    Attachments:
    You must be logged in to view attached files.
Viewing 15 results - 901 through 915 (of 3,053 total)