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 - 631 through 645 (of 2,951 total)
  • Author
    Search Results
  • #48735

    In reply to: List with Check box

    Brendan
    Keymaster

    Well the script is specific to the form because it’s referencing fields within the specific form. So ya, you need it in every form if you want the same behaviour in every form. Alternatively, a more advanced script could loop through all records of every form and look for specific fields to update to reset the checkmark field values.

    #48724

    In reply to: List with Check box

    Glen Forister
    Participant

    I thought I had failed to make it work, but then I remembered you said that was for the iPhone, so tried it there and it did work.
    Thanks.

    Seems like I have to install that script to every FORM which isn’t ideal, but will work.

    • This reply was modified 2 years, 9 months ago by Glen Forister.
    Attachments:
    You must be logged in to view attached files.
    #48715

    In reply to: List with Check box

    Brendan
    Keymaster

    The Advanced Find & Replace function is under the Records menu on the Mac version.

    There’s a script snippet called Basic Loop which just sets up a loop. But you would have to fetch the records first with var records = form.getRecords(); and then get each record within the loop and then set the value of the field using the record.setFieldValue(some_checkmark_field_id, 0); function. The 0 would set the checkmark field value back to off.

    Don’t forget to do a form.saveAllChanges(); outside of the loop at the end before the program ends so Tap Forms can save the values.

    This Form Script will reset all the checkmark fields for your Shield field back to OFF:

    function Reset_Shields() {
    
    	var shield_id = 'fld-d13c2bafe6e8482288c551bd8c931373';
    	var records = form.getRecords();
    	
    	for (var index = 0, count = records.length; index < count; index++){
    		var theRec = records[index];
    		theRec.setFieldValue(shield_id, 0);
    	}
    	form.saveAllChanges();
    }
    
    Reset_Shields();
    #48709

    In reply to: List with Check box

    Glen Forister
    Participant

    That sounds good.
    1. Where is that find and replace? I tried the Edit/Find & Replace in the menu, but all I could find was the “Find” in the upper right corner, no replace. Or, do you have a library of scripts that I can find that in? “check mark” = 0 & 1. I get that.

    2. When I’m in the filed, I will definitely need a script. Is that in this library of scripts?
    Thanks.

    I didn’t see where on the iPhone I would find that script. I didn’t see it in the “Tools”.

    • This reply was modified 2 years, 9 months ago by Glen Forister.
    #48707

    In reply to: Date sorting problem

    Glen Forister
    Participant

    Nope. Not on my iPhone 6s running 15.7.2

    I have many records each month. Between each month is a divider stating the name of the month (January, February, etc.). As I scroll down (records are sorted down in ascending order) and the first month divider (which I did not ask for nor is part of my data) hits the top and the headers for the columns disappear.

    But you seem to think this is standard as I read your response again. That isn’t right.
    I can go down, come up a ways, go down, anywhere in the list of records and I will never see the definitions of each column, the column headers. I never see them again until I get back to the first month divider and then the headers appear again. Throughout the whole time I can’t see what the identity of each column until I am at the top of the database and the 1st month divider scrolls down below and allows the headers to appear.
    Does that describe it? See attached file.

    While you are seeing this file, maybe you can tell me why the 2 scripts I’ve been given to allow me to see just 1 season of rain with the total rainfall in that 1 season view 22-23 starts at the beginning of the season with the total of 80.95 instead of 0.331 which is the total. for the 1st rain of the season.

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

    In reply to: List with Check box

    Brendan
    Keymaster

    In Tap Forms for Mac there’s a Find & Replace function which can do this sort of operation.

    For iOS you’d need to write a script that loops through all your records and resets the Checkmark fields to 0 (off) if you wanted to quickly start again.

    #48695

    In reply to: Day of Year

    Daniel Leu
    Participant

    Well, my first thought was a Javascript script… ;-) But then I wondered if the calculation field might do the trick. Yes, and here is the solution:

    DAYS(NEWDATE(DATE([Date day Collect];"yyyy");1;0;0;0;1;0;0;0);[Date day Collect])+1

    It looks complex but it isn’t:

    1) DATE([Date day Collect];"yyyy") extracts the year from your Date day Collect field. The square brackets are only an optical indicator.
    2) NEWDATE(...) creates the date for January 1st of your Date day Collect year.
    3) DAYS() calculates the days between two dates, the Januar 1st Date day Collect and Date day Collect.
    Then it’s just adding 1 to get the result. The return value is number.

    Attached is the formula in my editor. I used your rain collection data where date equals Date day Collect in your graphic. I did this on my desktop.

    Here is the link to the calculation field documentation: https://www.tapforms.com/help-mac/5.3/en/topic/calculation.

    Have fun!

    • This reply was modified 2 years, 9 months ago by Daniel Leu.
    • This reply was modified 2 years, 9 months ago by Daniel Leu.
    Attachments:
    You must be logged in to view attached files.

    Cheers, Daniel

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

    #48691

    Topic: Day of Year

    Glen Forister
    Participant

    DateCollected

    I’m interested in obtaining the day of the year (1 to 365).
    To do that I see how to insert another date field from the “Edit Formula” screen.
    The “Date Collected” in the pic attached.

    The problem is I don’t know how to get the difference (IN DAYS):
    – from Date which might be any of the last few years or future year
    and
    – Jan 1 of that year (or any year – not worried about leap year).

    My attached pic shows in that col (Day of Yr) the calculated days in text, but that got there from exporting out of another database program where it was calculated. But, future additions need to be calculated.

    Any help? I hope it isn’t a program script. So far I haven’t had any luck with that solution on another Form.

    Thanks.

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

    In reply to: Learning JavaScript

    Daniel Leu
    Participant

    Hmmm… your dataset doesn’t have an October 1st in there. So it doesn’t show that it works. At lest to me it seems to be working.

    If it still doesn’t work for you, did you do a “Refresh Record List”? Otherwise, please explain what’s not working.

    BTW, this is a field script as mentioned in https://www.tapforms.com/forums/topic/learning-javascript-2/#post-48648

    Cheers, Daniel

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

    #48680

    In reply to: Learning JavaScript

    Glen Forister
    Participant

    Sorry. That isn’t doing it. Look at my file and see what isn’t working.

    I tried putting it in the “Scripts” tab, and in the Field/Season Total tab in Scripts.

    Thanks for trying again.

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

    In reply to: List with Check box

    Glen Forister
    Participant

    Unfortunately, I have a form with checkmarks for 3 categories of items and a description of the item. In my old database I could check filter for a category if I wanted to (grouping them). Then the 1st checkbox was for when I had secured the item when I would check the item off the list.
    In Tap Forms I put the first checkbox on the top (iphone on left of table view).

    When I do this, I can’t check any of the items unless I go into that record.
    That is very distracting while searching for items to obtain and a waste of time.

    Also, about checkboxes there is something you really need that I can’t find. When I am finished with my operation of finding the things in the list (those all have the “get FIELD” checkbox checked which can be a lot of checks. When I remove the filter to bring all those items back from that FIELD onto the viewable form they are all visible. You need (if you don’t have) a way to select a FIELD of checkboxes and remove all the checks, or add all the checks depending.

    In fact, it would be useful for many FIELD types (text, checkbox, number) to be able to replace all the items in that FIELD to something else.

    #48675

    In reply to: Learning JavaScript

    Glen Forister
    Participant

    That is great. I put it in the script right after the other “var”s near the top. Hope that is the right place.

    function Get_Previous_Record() {

    var records = form.getRecords();
    var currentRecordIndex = records.indexOf(record);
    // added var for Oct 1st.
    var previousRecord = nil;
    var date = record.getFieldValue(‘fld-0720a5baa6fc4980aee22798bd089714’);
    if (date.getMonth() == 9 && date.getDate() == 1){ // check for October 1st
    return 0;
    }
    // end added var for Oct 1

    if (currentRecordIndex > 0) {
    previousRecord = records[currentRecordIndex – 1];
    }

    if (previousRecords != nil) {
    // fetch some value and do some calculation with it and the current record
    // the currently selected record is always accessed with the built-in variable
    // record
    }
    }

    Get_Previous_Record();

    #48674

    In reply to: Learning JavaScript

    Daniel Leu
    Participant

    The script checks for January 1st and if there is match, the return value is set to 0.

    Here is the update for checking for October 1st:

    	var date = record.getFieldValue('fld-0720a5baa6fc4980aee22798bd089714');
    	if (date.getMonth() == 9 && date.getDate() == 1){ // check for October 1st
    		return 0;
    	}
    	
    

    Cheers, Daniel

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

    #48671

    In reply to: Learning JavaScript

    Glen Forister
    Participant

    Thanks for the script. Wish I could understand it, but…

    Actually, the beginning of each rainy season is Oct 1 of the previous year extending to Oct 1 of this year.

    The records in my current view is only those records in that range, but sometimes I look at previous years with a different view search pattern.

    Will this do the job with that parameter?

    #48668

    In reply to: Learning JavaScript

    Glen Forister
    Participant

    I missed that import setting.
    Thanks.
    I imported all 5 years of data and now when I create a filter and just view this season, which is 38 records, the script sees all the records, not just this season.

    Do I need to create another field to delete the total at the beginning of the season to find the total for the season, or is there a more elegant way?

Viewing 15 results - 631 through 645 (of 2,951 total)