Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Using Tap Forms Pro › How to use the calculation field
- This topic has 9 replies, 4 voices, and was last updated 6 hours, 6 minutes ago by
ADDdb.
-
AuthorPosts
-
May 7, 2026 at 2:10 AM #54066
ADDdbParticipantHi, I’m fast running out of trial time and haven’t really got too far with attempting to create a form – two records and two fields with one of the fields working!
I know AirTable backwards but struggling to convert.
First up: am I right to think that a ‘Form’ is a table, but also refers to a record input form?
Secondly: my second attempt at a field is a calculation field. I want to display as text what appears in the other field in the same table: that other field is a link to form, many to many, and shows inverse relationship. It is the first field in that other form that I want to display, and that I believe is what I am selecting in the formula edit screen, but it returns nothing.
Attached is a screenshot of the formula edit field.
Any clues would be appreciated.
Thanks
AndrewAttachments:
You must be logged in to view attached files.May 7, 2026 at 7:19 AM #54068
Cliff RichardsonParticipantTry this. Replace Writer with your field, Counterparty Name. (no space between quotes).
Attachments:
You must be logged in to view attached files.May 7, 2026 at 12:54 PM #54071
BrendanKeymasterHi ADDdb,
1. A Form is equivalent to a Table in common database language. Within each Form there are Fields that comprise the types of data you want to capture (think of different columns in a spreadsheet). And each Form can have as many Records as you like to store the information in the fields.
2. Your screenshot doesn’t show the parent form, so I don’t know how you have it setup. But you can’t really display a single field or value from a Many to Many relationship. That’s because with a Many to Many relationship, there can be many fields and many rows in that relationship. Tap Forms does allow you to generate aggregate calculations for Number fields from a formula though.
If you need more advanced access to the rows and fields in a Link to Form field setup as a Many to Many relationship, then you’ll need to use JavaScript with a Script Field or Form Script that lets you loop over the records of the relationship and pick out the data that you want to display on the parent form.
Thanks,
Brendan
May 10, 2026 at 3:23 AM #54082
ADDdbParticipantTry this. Replace Writer with your field, Counterparty Name. (no space between quotes).
Thank you @Cliff Richardson. I tried this and nothing was returned.
Attached are shots of the Fine Name field definition in the Documents form, which is attempting to reference the first column in the linked field (Counterparty) from the Counterparties form. I’ve also attached this time the Documents single-column and multi-column list views (combined as one view).
I’ll check @Brendan’s post for a solution as well.
Regards
Attachments:
You must be logged in to view attached files.May 10, 2026 at 4:24 AM #54085
ADDdbParticipantHi @Brendon
1. A Form is equivalent to a Table in common database language. Within each Form there are Fields that comprise the types of data you want to capture (think of different columns in a spreadsheet). And each Form can have as many Records as you like to store the information in the fields.
That makes sense. Thanks
2. Your screenshot doesn’t show the parent form, so I don’t know how you have it setup. But you can’t really display a single field or value from a Many to Many relationship. That’s because with a Many to Many relationship, there can be many fields and many rows in that relationship. Tap Forms does allow you to generate aggregate calculations for Number fields from a formula though.
I’ve attached updated parent and child forms and the Record ID field (previously called File Name) calculation.
The child form, Counterparties shows two records (Coles and Energy), but on the parent form in the one record I have selected one record from Counterparties (Energy).
Perhaps I could elaborate on what I am trying to do and compare this to how it works in AirTable which might help to establish if and how (or if not) this can be achieved in TFP?…
My objective is to maintain a child form (Counterparties form) with many fields pertaining to counterparties. On the parent form (Documents), one of the things I want to show for each relevant record is a selected counterparty name from the child form (the option exists to show more that one per parent form record, but in this case I just need one). I also want to show for that parent record two other fields from the child form that pertain to that particular counterparty, but I don’t want to see all of the many fields from the child form repeated in the parent form.
In AirTable in the parent form (Documents) in a new field (Counterparty) I would link to another form, by selecting that form in a dropdown. I could then select a record in this new field in the parent form, and a dropdown in that field would allow me to link to a particular record in the child form. The record ID selected in the child form would then appear in the field in the parent form. The record ID comes from the left-most field in a form, in this case the child form.
This appears to be similar to what I have achieved in TPF in the table appearing to the right of the Counterparty field in the single column view in the parent form (in this case I selected Energy).
In AirTable, I can then create new fields in the parent form to show other fields from the child form (AT calls them a Lookup); in this case I want two more. So in total there would be three fields in the parent form drawing from the child form: the link to the record ID (Counterparty) and two others (say, Address and Phone No.), but in this case I don’t want to see Counterparty Logo and so I don’t select that one.
I then want to create a left-most ID field (Record ID) in the parent form that concatenates certain fields in that form, in this case Counterparty (which would ideally be the Counterparty Name from the child form) and Legal Briefs (the latter being a text field in the parent form). Note that I am trying to do that using the Calculation function (but perhaps that is wrong).
Attempting to do this in TFP, I see in the parent form that the Counterparty field is linked to the Counterparties forming a many to many relationship with inverse relationships shown. In the multi-column view at the top nothing is shown (which surprises me). In the single-column view underneath in Counterparty field there is a a table which shows two of the four fields in the Counterparties child form. I’m not sure why two of four only appear, but I really need only one for my use case: Counterparty Name and I have successfully selected one record: Energy (but as noted it doesn’t appear at the top under the Counterparty field (?)).
After trying my formula (“calculation”) and the recommendation from @Chris Richardson I cannot get anything to appear in the Record ID. What I want to show is [Counterparty]-[Legal Briefs], for example the second record might show the same counterparty with a legal brief no. 2.
So I am stuck on this as well.
If you need more advanced access to the rows and fields in a Link to Form field setup as a Many to Many relationship, then you’ll need to use JavaScript with a Script Field or Form Script that lets you loop over the records of the relationship and pick out the data that you want to display on the parent form.
Ok. If that is the only way to achieve what I am after then I would investigate that. I’d appreciate confirmation or otherwise that based on my long explanation above, that scripting is the only way before embarking on that (and considering whether it is a route I want to pursue given how easy it is in AT and scripting sounds like more work(?)).
Many thanks
Attachments:
You must be logged in to view attached files.May 10, 2026 at 8:08 AM #54089
Daniel LeuParticipantWhat you’re after can’t be done in
calculation fields. You need to usescript fields. Here’s a small sample script that returns the value of a given field.// From a linked form, fetches all values for a given field. function getLinkedFieldValue(link_id, link_num, linked_field_id){ const linkedRecs = record.getFieldValue(link_id) if (linkedRecs) { linkedValue = linkedRecs[link_num].getFieldValue(linked_field_id) if (linkedValue){ return linkedValue; } } } function main() { const childForm_id = 'fld-588ffa6326894f809eee01372e96755a'; const child__name_id = 'fld-921163e2400545898782e744e6a79750'; const childNum = 0; // first child selected const childName = getLinkedFieldValue(childForm_id, childNum, child__name_id); if (childName){ return childName; } } main();Now you only need to set the field ids for the link field and the child field. You can get them in the script editor by selecting the name of the field in the left side column, then click on the
IDbutton.Two concatenate several values, you can use following
const childFirstName = getLinkedFieldValue(childForm_id, childNum, child__firstName_id); const childName = getLinkedFieldValue(childForm_id, childNum, child__name_id); return childFirstName + ' - ' + childName;It will take a bit more time than just selecting a field in a popup, but using Tap Form Pro’s powerful JavaScript API, you can accomplish many tasks. Oh, don’t forget to set the return type according to your field type.
Hope this helps!
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksMay 11, 2026 at 11:44 PM #54097
ADDdbParticipantI prepared a detailed response and pressed submit but the response did not post and the contents of the form including attachment was wiped. Will try again…
May 11, 2026 at 11:51 PM #54098
ADDdbParticipantThank you, @Daniel Leu, for your detailed response.
I have attempted to implement your suggested code in the first code block to populate the Record ID field in the parent form (Documents).
The resulting Record ID field screen is attached.
The error message shown applies to lines 16 and 20.
I then removed the offending term ‘var’ from both lines and the following error appeared:
2026-05-12, 16:36:59 / Documents (parent) / Record ID Record ID: ReferenceError: Can't find variable: counterparty, line:(null)I am not sure what corrections I need to make from here, and note that the extraneous ‘var’s were inserted by TFP when I clicked the ID button?
I am also not sure if I should just add the code in the second code block provided to the code in the screenshot to enact the concat?
Appreciate your help.
Regards
Andrew-
This reply was modified 1 day, 12 hours ago by
ADDdb.
Attachments:
You must be logged in to view attached files.May 12, 2026 at 8:28 AM #54103
Daniel LeuParticipantHi Andrew,
1) You really just need the ‘fld-xxxxx’ section from the code Tap Forms Pro inserted. You could rename the variables to make it more readable, but that’s not necessary.
2) When you create a new field script, I would remove the default code. But javascript supports the structure you wrote (as far as I can tell).
Here’s the code with your field ids:
// From a linked form, fetches all values for a given field. function getLinkedFieldValue(link_id, link_num, linked_field_id){ const linkedRecs = record.getFieldValue(link_id) if (linkedRecs) { linkedValue = linkedRecs[link_num].getFieldValue(linked_field_id) if (linkedValue){ return linkedValue; } } } function main() { const childForm_id = 'fld-42f52b4ec1ca4514ac86af90d8d6e718'; const child__name_id = 'fld-9d0490166c594a34bc8e8f9967510f4f'; const childNum = 0; // first child selected const childName = getLinkedFieldValue(childForm_id, childNum, child__name_id); if (childName){ return childName; } } main();Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksMay 13, 2026 at 6:39 AM #54111
ADDdbParticipantHi Daniel
That’s brilliant. I was able to populate and also get two child names to work with your code.
My discovery continues…Many thanks
Andrew -
This reply was modified 1 day, 12 hours ago by
-
AuthorPosts
You must be logged in to reply to this topic.