Hi Robert,
I too tend to steer away from calculations except for using Servoy’s nifty rowbackground color calculation. I’m not quite sure I understand your description of the relationship so let me start over and just describe exactly what I showed relationship-wise.
Three tables: parent table is patient with PK of patient_id. Two child tables: sample and diagnosis with FK of patient_id. In the first picture the form (based on patient) is just using those simple relationships to show the columns of the child relationships. However, if a particular patient record doesn’t have a child table, the patient record still displays and the child columns are just blank (as picture 1 shows), in other words an outer join.
In picture 2 I haven’t limited the patient records in any way although I could. But what I am doing is changing the relationship to each child record slightly. Instead of just a patient.patient_id to sample.patient_id relationship, I am also adding a second part to the patient-sample relationship (and patient-diagnosis). I am also relating those tables based on the values in the global fields labeled ‘OuterJoinCriteria1’ (for the sample table) and ‘OuterJoinCriteria2’ (for the diagnosis table). What this does is identical to what you are doing in your outer join, namely displaying zero or one CHILD columns that match the criteria of the outer join while retrieving ALL parent records (or that meet the rest of the WHERE criteria): in your case it is ‘HS’ and ‘2005’, in our case it is ‘sp’ and ‘l’.
You then bring up that point namely:
Can you display patients having a certain value in source, e. g. sp?
Naturally you can limit the PARENT table in any way that you want with the overall query that populates the parent form in the first place. So to use an example that could be seen in picture 1…
Let’s say I limit the rows from the parent table like this:
SELECT patient_id
FROM patient p, diagnosis d
WHERE p.patient_id = d.patient_id
AND d.stage = '2a'
In this case, of the patient records shown currently in picture1, you would only retrieve three patient records: 105, 110 and 112. If you further selected ‘h’ as the ‘OuterJoinCriteria2’, you would only see child2 (diagnosis) column data for 112 but the patient records of 105 and 110 would still be showing of course.
There really isn’t anything different about this than normal querying/relationships. Using globals in a relationship just gives you the power of dynamic relationships that can be set ad hoc by the user or the developer based on events. And any ‘relationship’ itself is simply a ‘query’ as well, just a little more optimized. (Now off to bed for me!) ![Smile :)]()