# How do I copy data from a Portal to a Field?

**URL:** https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514
**Category:** Questions
**Tags:** filemaker
**Created:** [November 29, 2024, 6:14pm UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514 "2024-11-29T18:14:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![JTBearcat](https://avatars.discourse-cdn.com/v4/letter/j/f04885/32.png) [@JTBearcat](https://the.fmsoup.org/u/JTBearcat)
#### Post date: [November 29, 2024, 6:14pm UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514/1 "2024-11-29T18:14:43Z")

</div>

I have a layout which consists of a portal to related records. I've duplicated the portal and listed only a summary field to show the totals of those related records (so far, so good).

But I'd like to "capture" the value of that summary field by copying it into a field on the layout (outside the portal).

How do I accomplish that?

 ![2024-11-29_12-55-14](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/6/6bd8ddab8ebe20c14df5aa50215df7e4cb1d74b9.png)

---

<div class="post-metadata">

### Author: ![janhagemeister](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@janhagemeister](https://the.fmsoup.org/u/janhagemeister)
#### Post date: [November 29, 2024, 6:38pm UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514/2 "2024-11-29T18:38:43Z")

</div>

Is this a filtered portal? You need a relationship that retrieves exactly the records you see in the portal. With the Sum() function, you can then copy the result for further calculations.

Jan

---

<div class="post-metadata">

### Author: ![FabriceN](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/fabricen/32/2506_2.png) [@FabriceN](https://the.fmsoup.org/u/FabriceN)
#### Post date: [November 29, 2024, 10:36pm UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514/3 "2024-11-29T22:36:02Z")

</div>

name the field object "total" and set a variable the value : GetLayoutObjectAttribute ( "total" ; "content" )

---

<div class="post-metadata">

### Author: ![Malcolm](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/malcolm/32/196_2.png) [@Malcolm](https://the.fmsoup.org/u/Malcolm)
#### Post date: [November 30, 2024, 6:46am UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514/4 "2024-11-30T06:46:04Z")

</div>

Set Field [“mileageExpenses” ; relatedTable::summaryField]

> [@FabriceN](#):
>
> I don't think this will that the portal filter into account

I agree, we need to be in the context of that portal, and you're suggestion works perfectly well, and is simpler to implement.

```auto
Select Object ["mileage expenses portal"]
Go to Portal Row []
Set Field [“mileageExpenses” ; relatedTable::summaryField]

```

---

<div class="post-metadata">

### Author: ![FabriceN](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/fabricen/32/2506_2.png) [@FabriceN](https://the.fmsoup.org/u/FabriceN)
#### Post date: [November 30, 2024, 10:40am UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514/5 "2024-11-30T10:40:45Z")

</div>

I don't think this will that the portal filter into account

---

<div class="post-metadata">

### Author: ![weetbicks](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/weetbicks/32/206_2.png) [@weetbicks](https://the.fmsoup.org/u/weetbicks)
#### Post date: [December 2, 2024, 1:00am UTC](https://the.fmsoup.org/t/how-do-i-copy-data-from-a-portal-to-a-field/4514/6 "2024-12-02T01:00:11Z")

</div>

Summary fields and filtered portals play nice now, though it wasn't always the case. @Malcolm has the solution - just do your set field form the portal context and it will summarise visible (filtered) values only.

Sum() is a relationship-level function which will deliver a different result for a filtered portal.
