AnsweredAssumed Answered

Synchronized Portals

Question asked by NaturSalus on May 7, 2012
Latest reply on May 7, 2012 by NaturSalus

Title

Synchronized Portals

Post

Hello,

I have two synchronized portals that are working fine, although I would like to modify their behavior and I don't know how.

 

In a layout to Appointment_Detail TO I have the following two synchronized portals:

    • Portal to the "AppointmentDisease" TO (master portal)
    • Portal to the "MedicineDisease" TO

 

On the portal to the  "AppointmentDisease" TO are listed the diseases that the user has added to the current "Appointment" record.

On the portal to the "MedicineDisease" TO are listed the medicines that treat the diseases listed and selected on the master portal.

So if the user selects just the disease diarrhea on the portal to the  "AppointmentDisease" TO, the portal to "MedicineDisease" TO list the medicines that treat that condition.

For example,

The disease diarrhea is treated with medicines:

    • medicine 2
    • medicine 3

 

If the user adds only the disease diarrhea to the portal to the  "AppointmentDisease" TO (master portal), then the portal to "MedicineDisease" TO lists the medicines: medicine 2 and medicine 3.

So far, no problem.

 

But what happens if the user adds more that one disease and the diseases share some common medicine? In this case the shared medicine is repeated several times.

For example,

The disease flatulence is treated with medicines: medicine 1, medicine 3, and medicine 4.

 

If the user adds the diseases diarrhea and flatulence to the the portal to the  "AppointmentDisease" TO (master portal), then the portal to "MedicineDisease" TO lists the medicines:

    • medicine 1
    • medicine 2
    • medicine 3
    • medicine 3
    • medicine 4

 

And what I would line to get is a list of only the different medicines so that no repeating medicine is included. The desired outcome is:

    • medicine 1
    • medicine 2
    • medicine 3
    • medicine 4

 

My first question is what modificationsdo I need to introduce to the "Disease & Medicine Sync Portals" script so that I don't get repeated values on the the portal to "MedicineDisease" TO list?

 

RELATIONSHIPS

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

 

LAYOUT

"Appointment_Detail" layout to the “Appointment” TO with two portals:

 
  • Portal to the "AppointmentDisease" TO which is considered the "master" portal and which displays the diseases added by the user to the current Appointment record.
  • Portal to the "MedicineDisease" TO which is considered the "synchronized child" portal which displays only the medicines adequate to treat the Disease selected by the user.

 

Portal to the "AppointmentDisease" TO

Portal Fields:
 
      • Disease::dCommonName
      • Disease::BodySystem
      • Disease::BodyOrgan
 
In the "Appointment_Detail" layout to the Appointment TO, there is the "Add Disease" button that triggers a script by which the user adds the diseases shown in the current appointment record.
The three portal fields of the "AppointmentDisease" portal trigger the "Disease & Medicine Sync Portals" script and at the same time have a conditional formatting that highlights the selected portal row.

To highlight the selected portal row of the portal to the "AppointmentDisease" TO. Conditional formatting:
$$Disease = AppointmentDisease::_kf_Disease
 
Here I have my second problem: the conditional formatting works only when there is only one value on the Portal to the "AppointmentDisease" TO.
So, if for example the user have entered: diarrhea and flatulence. The only value selected is "diarrhea".
My second question is: what modifications do I need to introduced so that the highlight is on the row selected by the user and not on the first portal row?


"Disease & Medicine Sync Portals" script is as follows:

Error Handling
Allow User Abort [Off]
Set Error Capture [On]
#
Go to Object [ObjectName: "aMedicine"]
Set Variable [$$DiseaseID; Value: AppointmentDisease::_kf_Disease]
Refresh Window [Flush cached join results]

 

Portal to the "MedicineDisease" TO

Portal Fields:
 
      • Medicine::mCommonName
      • Medicine::mScientificName
      • Medicine::Type

Filter portal records: $$DiseaseID = AppointmentDisease::_kf_Disease

 

Thanks,

natursalus

Outcomes