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.

checkbox for a join table

Featured Replies

Hi,

I have a many to many relation (patients <-> allergies)

Tables: patient, allergy, join_patient_allergy

Problem:

On the Patient layout I would like to have a checkbox for each allergy.

I've looked into the JoinDemo.fp7 (found somewhere in this forum) to better understand this type of relationship. There the solution is a portal but I would like to use the checkboxes and I don't know how.

Any ideas?

Regards

ChiSao

It opens a different problem, because facilitating each join table record with a checkbox with the shortest possible value list is just a graphical issue easily solved in layout mode. But each record would then need to be pre-populated with records - one for each required allergy. This could talk in favor of omitting the join table or instead use this approach:

http://www.fmforums.com/forum/showpost.php?post/149069/

If you not are fully aware of what he does in this template, would I suggest you make the many 2 many join'less.

--sd

I found that I'd better make a template showing how would approach it...

--sd

allergies.zip

  • Author

Thanks a lot

seems to be a nice solution but I have to take a closer look to the template to understand the mecanisme.

Nice to have such a help in this forum.

Regards

by

ChiSao

  • Author

Thanks a lot! This one is easier to understand ;-)

I will work with this one

by

ChiSao

There would possibly be something to crack though, what he does isn't a layout format checkbox but an emulation via the boolean formatting of numberfields, but yes very elegant indeed! If it should be easier to grasp is another thing ... if relational structures side gain is to prevent lengthy scripting ... not that the scripting here is whopping though.

--sd

IIUC, your file avoids scripting by leaving an orphaned join record when unchecking a box. So for example, counting a patient's allergies by Count ( Join::PatientID ) would return an incorrect result.

I am also not at all sure how you intend to keep Allergies and Slots synchronized: currently, if you delete an allergy, you are stuck with an empty portal row holding its place.

Count ( Join::PatientID ) would return an incorrect result.

But I would count on the check'ed field instead... the value is even one, so Sum( would do similar

if you delete an allergy, you are stuck with an empty portal row holding its place.

Yes that's true - but how often will an allergy evaporate for ever! So if that happens will a scripted replace of the ID's be urged...

--sd

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.