How to move selected portals info into a different field
My objective is to be able to add to a field (Appointment_Detail::Treatment) the different trreatment options or drugs that are shown on a portal to the Medicine TO.
On a layout to the Appointment_Detail TO, based on the Appointment table, I have a portal to the Medicine TO which is the "synchronized child portal" of the master portal to "AppointmentDisease" TO (master portal).
So, for each patient the therapist creates as many appointments as appropriate. For each appointment, and based on his/her diagnosis, he selects the diseases that apply to the case at hand, and for each disease there are several possible medicines or drugs. Finally, the therapist must come up with a treatment based on the diseases diagnosed and the available medicines.
I would like to be able to set up a script that detects which rows of the portal to the Medicine TO is selected by the therapist and then puts that information into the Appointment_Detail::Treatment field. Since more than one medicine could be needed it should be possible to add each new selected medicine to the medicines already in the Appointment_Detail::Treatment field.
portal to the Medicine TO
First he therapist selects Drug 1 and its information is put into the Appointment_Detail::Treatment field. SO you get:
Then the therapist selects Drug 3 and its information is put into the Appointment_Detail::Treatment field. And gets:
In the end, all the medicines selected are sequentially added to the Appointment_Detail::Treatment field contents.
Appointment --< AppointmentDisease >--Disease --< MedicineDisease >--Medicine
Appointment::__kp_Appointement = AppointmentDisease::_kf_Appointment
AppointmentDisease::_kf_Disease = Disease::__kp_Disease
Disease::__kp_Disease = MedicineDisease::_kf_Disease
MedicineDisease::_kf_Medicine = Medicine::__kp_Medicine
I am lost as to what should I do. Do I need to create an intermediate table? can I move directly subsequent portal rows into a field? what are the functions or scripts setps that I should use?
I didn't know what to look for in the forum to find out whether the same question has been asked and answered before.