3 Replies Latest reply on Jul 9, 2015 11:34 AM by GuyStevens

# Calculations in portals

### Title

Calculations in portals

### Post

Hello,

I'm using FM 14 Pro ADV to build a Fitness Database.

My objetive is to have a record that represents a client and right next to the name of the client a portal with his weight and other body measurements (existing in a Measurements Table) in which I can see the the diferences through time to see if the treatments/ exercises are working.

So, I'd want to have something like this:

PORTAL

10 July 15                85Kg     90cm

10 August 15           83Kg     87cm     -2Kg     -3cm

10 September 15     80Kg     85cm     -3Kg     -2cm

I want to create fields that calculate the subtraction between the previous portal row and the current new row I've just inserted.

How can I do this?

Thank you!

• ###### 1. Re: Calculations in portals

Hi Goncalo,

This might work by adding a second table occurrence of your measurements table and relating it to the original one If you relate it using the date fields and show only the date higher then the current record.s date then you might be able to get the date from the record above in the table occurrence that you can then use to calculate the difference.

The relationship would be between the date fields and would be a "is greater than" type.

Then you can create calc fields in your measurements table that subtract the weight from the Table occurrence from the weight in the measurements table.

This is just off the top of my head, but I think this should work.

• ###### 2. Re: Calculations in portals

It seems to me that since a client will be measured multiple times, that each set of measurements needs to be its own record in a separate table related to the client table. Is that what you mean by your Measurements Table? The record could simply have the client's ID as a foreign key, a date on which the measurements were taken, the measurements themselves, and perhaps any other relevant notes (the client and been sick for a week before, the day was exceptionally hot, etc). Then comparing progress would be relatively simple because all measurements could be shown in a portal on the client's record.

• ###### 3. Re: Calculations in portals

What you are saying is correct keywords, but that's the basic initial setup. Which I think he already has.

A client table with a related measurements table.

The tricky part is in comparing a measurement to a previous measurement. And that's why I suggested to make a second table occurrence and to relate it using a date to define the relationship. Then a calculation can be made using the the tables occurrences to compare the measurements.