Jump to content

checkbox for a join table


This topic is 5615 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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

This topic is 5615 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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