ChiSao Posted September 15, 2009 Posted September 15, 2009 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
Søren Dyhr Posted September 15, 2009 Posted September 15, 2009 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
Søren Dyhr Posted September 16, 2009 Posted September 16, 2009 I found that I'd better make a template showing how would approach it... --sd allergies.zip
ChiSao Posted September 16, 2009 Author Posted September 16, 2009 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
comment Posted September 16, 2009 Posted September 16, 2009 How about a simple one? CheckboxJoin.fp7.zip
ChiSao Posted September 17, 2009 Author Posted September 17, 2009 Thanks a lot! This one is easier to understand ;-) I will work with this one by ChiSao
Søren Dyhr Posted September 17, 2009 Posted September 17, 2009 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
comment Posted September 17, 2009 Posted September 17, 2009 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.
Søren Dyhr Posted September 17, 2009 Posted September 17, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now