Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
January 18, 2023 at 10:10 PM #48709
In reply to: List with Check box
Glen Forister
ParticipantThat 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 3 years, 3 months ago by
Glen Forister.
January 18, 2023 at 10:01 PM #48707In reply to: Date sorting problem
Glen Forister
ParticipantNope. 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.January 18, 2023 at 9:09 PM #48703In reply to: List with Check box
Brendan
KeymasterIn 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.
January 18, 2023 at 7:03 PM #48695In reply to: Day of Year
Daniel Leu
ParticipantWell, 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])+1It looks complex but it isn’t:
1)
DATE([Date day Collect];"yyyy")extracts the year from yourDate day Collectfield. The square brackets are only an optical indicator.
2)NEWDATE(...)creates the date for January 1st of yourDate day Collectyear.
3)DAYS()calculates the days between two dates, theJanuar 1st Date day CollectandDate day Collect.
Then it’s just adding 1 to get the result. The return value isnumber.Attached is the formula in my editor. I used your rain collection data where
dateequalsDate day Collectin 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 3 years, 3 months ago by
Daniel Leu.
-
This reply was modified 3 years, 3 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&tricksJanuary 18, 2023 at 5:02 PM #48691Topic: Day of Year
in forum Using Tap Forms 5Glen Forister
ParticipantDateCollected
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.
-
This topic was modified 3 years, 3 months ago by
Glen Forister.
-
This topic was modified 3 years, 3 months ago by
Glen Forister.
Attachments:
You must be logged in to view attached files.January 16, 2023 at 9:08 PM #48682In reply to: Learning JavaScript
Daniel Leu
ParticipantHmmm… 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&tricksJanuary 16, 2023 at 5:31 PM #48680In reply to: Learning JavaScript
Glen Forister
ParticipantSorry. 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.January 16, 2023 at 3:41 PM #48678In reply to: List with Check box
Glen Forister
ParticipantUnfortunately, 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.
January 16, 2023 at 2:25 PM #48675In reply to: Learning JavaScript
Glen Forister
ParticipantThat 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 1if (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();
January 16, 2023 at 1:13 PM #48674In reply to: Learning JavaScript
Daniel Leu
ParticipantThe 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&tricksJanuary 16, 2023 at 10:13 AM #48671In reply to: Learning JavaScript
Glen Forister
ParticipantThanks 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?
January 15, 2023 at 3:29 PM #48668In reply to: Learning JavaScript
Glen Forister
ParticipantI 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?
January 15, 2023 at 2:23 PM #48666In reply to: Learning JavaScript
Glen Forister
ParticipantI figured that out. thanks.
The file I used was for learning and had only this season. I thought it would be good to start with a small file.
I tried to import the whole 5 years into the file, but import created a new file Form with the same name instead of adding to the current form. So I tried to duplicate the format for the new form but failed. I think I have all the file properties correct, but the script just gives me “NaN” in the field (even after repeated refresh). You have a clue what I missed, or can I copy records from this form and add them to the working form?BTW, somehow the Date col disappeared which produced bogus charts obviously. I added a new Field (DATE) and moved it to the top and after configuring the field the original data appeared out of nowhere. What happened here? I couldn’t find that data until it suddenly appeared, and how did it disappear in the first place?
January 14, 2023 at 7:23 PM #48657In reply to: Learning JavaScript
Glen Forister
ParticipantThat didn’t quite work. Looping to get all every time? Here is the first 3 lines of the relult. This is one thing I like about programming, always a surprise.
Day tot. Sum
0.03 0
0.31 0.310
0.23 0.230.310
0.33 0.330.230.310Brandon’s script results
0.03 0
0.31 0.310
0.23 0.230.310
0.33 0.330.230.310-
This reply was modified 3 years, 3 months ago by
Glen Forister.
January 14, 2023 at 4:14 PM #48655In reply to: Learning JavaScript
Daniel Leu
ParticipantSorry, this is intended to be a field script for the Season Tot field.
And you need to run Refresh Records List (control-option R).
-
This reply was modified 3 years, 3 months ago by
Daniel Leu.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks -
This reply was modified 3 years, 3 months ago by
-
AuthorSearch Results