Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › number of different items in a field (Mac)
- This topic has 3 replies, 2 voices, and was last updated 1 year, 8 months ago by Brendan.
-
AuthorPosts
-
April 10, 2023 at 4:21 AM #49323
Rudy ZwartjensParticipantI am struggling with something that should be so obvious to a database that I think I missed it. I have a database with about 400 folk melodies from many countries. When I make a set list for a performance using a saved search, I would like to know how many *different* countries are collected in that search.
To clarify with an example of a “mini” set list:TITLE COUNTRY
Garoon Armenia
Hey Par Armenia
Hora Romenia
Musette1 France
Musette2 FranceWhat I like to get:
COUNTRY #
Armenia: 2
Romenia: 1
France: 2
Countries: 3Hopefully someone can help me solve this and comparable problems.
Greetings from The Netherlands.
April 10, 2023 at 4:25 PM #49327
BrendanKeymasterHi Rudy,
You can do this by setting the Group Records By option to your Country field.
Then switch to the multi-column list view and click on the Sigma ∑ button to show the Calculations Row.
Click on your Country field in the Calculation Row footer and choose Count.
Tap Forms will now show you how many countries you have there.
Next, click the little menu button at the top-right of the multi-column list view and then select “Show Group Summaries”. Now Tap Forms will show you the counts within each grouping of records for each country. So you’ll be able to see how many of each country there are.
Hope that helps!
Brendan
April 11, 2023 at 8:01 AM #49330
Rudy ZwartjensParticipantThank you Brendan for your – as usual – fast reply!
The solution you describe is known for me (but still very useful as a reminder), so I now understand that I my explanation was not complete.
I hoped to be able to “fill” a field – at least – with the number of different countries, so I could print that number together with the set list.
BTW, the set list is printed using a label layout, the only way to get it printed like I want.In the meantime I was puzzling with a DIY solution.
I used a checkbox field [c.change] with a check on every first tune in a country:Garoon Armenia check
Hey Par Armenia
Hora Romenia check
Musette1 France check
Musette2 FranceWith your described method I found: 3 countries, right!
To get this count value in a field I used a calculation field with formula:
IFNOTEMPTY([c.change];sum([c.change]);0) . In the formula I used no brackets.
The result was empty, so this appears not to be right (too simple?).Then I used a script field using a sample for summation:
function getFieldTotal() {
var field_id = record.getFieldValue(‘fld-5e8d5d2744d4e2cbdbc9f3d7ac1cc35’);
// whatever the field ID is for the field you want the total of.
var total = form.getTotalOfField(field_id);return total;
}getFieldTotal();
Also this field stays empty. So it is clear: I still have to learn a lot!
Will you please give me a hint in the right direction?
I am not afraid of programming, but I have no experience with Java.Thanks in advance.
Rudy
April 13, 2023 at 12:25 PM #49333
BrendanKeymasterHi Rudy,
Make sure when you add your fields to your formula that you double-click on the field on the left side of the formula editor to insert the field into your formula. Don’t just type the field name. The square brackets around the field name are for the iOS version only.
For your script, make sure you have the Result Type set to Number. The same for the calculation field.
If you want me to look into your form, please email me your .tff file (export Tap Forms Form Template in the File menu).
Thanks,
Brendan
-
AuthorPosts
You must be logged in to reply to this topic.