Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › Use total of form column as trigger?
- This topic has 3 replies, 3 voices, and was last updated 2 years ago by Brendan.
-
AuthorPosts
-
November 30, 2022 at 7:53 AM #48370
richard maliszewskiParticipantI know that in multi-column view, I can view the summation (and other stats) for any column using the sigma “row” at the bottom. I can also set the “calculation” for a form to a field and type.
I’d like to use the total of a column as a script trigger. It looks like to do that, I’d need the field ID for that value. Is that field ID per form immutable, and is there a way to get at that?
–Richard
November 30, 2022 at 10:04 AM #48371
Daniel LeuParticipantThe field ID will not change. You get the code in the script editor: click on the name of the field and then on
ID
. This will insert the code in the editor section.November 30, 2022 at 10:51 AM #48372
richard maliszewskiParticipantI was insufficiently clear. There’s no visible “field” per se to click on…I’d like to keep a watch on the total of a field in another form. That form has, in its definition, a ‘calculation’ wherein I can specify a field and type of calculation. What’s that used for? Does it wind up in some field? It seems like TF may also be keeping running stats on fields, and I was surmising that those stats might be pseudo-fields. Being able to keep watch on the field values’ total is what I am hoping for.
Getting the field ID for the field value I want to watch wasn’t hard. Setting a watch on it from another form seems to be difficult, if not impossible. It seems like either of the things I am talking about wanting to watch would be form properties rather than field properties.
–Richard
December 1, 2022 at 12:54 PM #48383
BrendanKeymasterThe Calculation Field and Calculation Type settings on a Form just tell Tap Forms what the default calculation value to display is on the Single Column List View. Although it does display that result if there’s no Field level summary calculations set.
There’s a popup button that will display the aggregate calculations for all of the individual Field level Summary Calculations. By selecting a different one to display, you’re changing the Form’s Calculation Field. It has no bearing on the Multi-Column List View because that view will always display all of the individual Field level calculations.
There’s no Field ID available for the Calculation Field setting explicitly because that’s just a reference to the actual field in the form, which you can get the ID for either on the Script Editor as Daniel mentioned, or at the bottom of the Fields list on the Fields tab of the Form inspector panel.
There’s no ability to watch the aggregate calculation. But the Scripting engine does have functions for getting that value if you need to.
For example, to get the total of a field in a form, use:
form.getTotalOfField(fieldID);
You can of course get the form using either
form
if it’s the currently selected form orlet other_form = document.getFormNamed('Other Form');
-
AuthorPosts
You must be logged in to reply to this topic.