Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Create related table with average value

Featured Replies

I have a somewhat complex related table problem;

At the moment, I have a table Sequences with data of the sort

[color:green]Patient - text

[color:green]Time - number

[color:green]Sample - text

[color:green]SeqLength - number

In [color:black]Sequences, there are often several entries that share the same [color:green]Patient, [color:green]Sample and [color:green]Time values.

I now need a new related table Visits that has a single record for every unique [color:green]Patient/[color:green]Time /[color:green]Sample combination. In the new related table, I would like to have a field [color:red]AveSeqLength that is the mean of all of the [color:green]SeqLength entries from matching records in Sequences. The Sequences table is very large, and I would like to avoid having to manually enter records into Visits but I am not sure how to do this. Also, I am not sure how to make the [color:red]AveSeqLength field.

Any thoughts welcome!

  • 2 weeks later...

In your Visits table, define a calculated field AveSeqLength with the formula:

Average(Sequences::SeqLength)

That's the simple part.

Now you need to get a set of unique Patient/Sample/Time records in the Visits table. The simplest way is to generate them from the Sequences table. When you set up your relationship (based on Patient=Patient and Sample=Sample and Time=Time), check the "Allow creation of records in this table via this relationship" boxes in the "Edit Relationship" window. Then create this script and run it from the Sequences table:


Go to Record/Request/Page [First]

Loop

   Set Field [Visits::Patient; Sequences::Patient]

   Go to Record/Request/Page [Next; Exit after last]

End Loop

Edited by Guest

  • 5 weeks later...
  • Author

Thank you, this worked very well! Help much appreciated.

Marcel

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.