Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Using Tap Forms 5 › Latest Date
- This topic has 5 replies, 2 voices, and was last updated 4 years, 9 months ago by
Martha Montgomery.
-
AuthorPosts
-
January 31, 2021 at 9:08 PM #43346
Martha MontgomeryParticipantNew to Tapforms and trying to add a field for the latest date. I have tried using Maximum on the date field, but the result is not what I expect. The calculation is automatically filling in “Count”. The fields are joined in the two forms. In the pdf attached, I have included the field setup, calculation and the results…it is showing the date of Dec 31 1969 instead of Sep 30, 2020.
I also tried to change “Count” to “Max”, but it will not let me.
Any suggestions are appreciated.
Attachments:
You must be logged in to view attached files.February 2, 2021 at 5:02 PM #43353
T.L. FordParticipantA script field would work.
var when_id = 'fld-a13ae3e64dd340138d08e719fe2a9aa9'; var childform_id = 'fld-8ead2e10d2634bd4925175d72f943857'; function Max() { var arr = record.getFieldValue(childform_id); arr.sort(compare); return arr[0].getFieldValue(when_id); } function compare(a, b) { if (a.getFieldValue(when_id) > b.getFieldValue(when_id)) { return -1; } else if (b.getFieldValue(when_id) > a.getFieldValue(when_id)) { return 1; } return 0; } Max();You will need to get your field ID’s.
Make sure you set the return results type to Date.February 2, 2021 at 9:08 PM #43354
Martha MontgomeryParticipantThanks so much. I will give this a try.
February 3, 2021 at 4:29 PM #43360
Martha MontgomeryParticipantI am so very excited! I could not get this to work at first due to my limited knowledge, but after watching a couple of Sam Moffitt’s YouTubes and retrying to make sure I was picking the right fields, I got it to work. Thanks so very much!!!!
February 3, 2021 at 5:00 PM #43361
T.L. FordParticipantThat’s awesome! I’m so glad!
The scripting is powerful, but it also has a fairly steep learning curve. I have an intro to scripting here: http://cattail.nu/tap_forms/tap_forms_scripting_101/index.html
– T
February 3, 2021 at 5:04 PM #43362
Martha MontgomeryParticipantThanks for the link! I am definitely going to review it.
-
AuthorPosts
You must be logged in to reply to this topic.