How to isolate a set of rows in a table referenced to another table?

Hi,
In my patient database app, I have a table called โ€œPersonal Detailsโ€ that has a key column that generates unique IDs for each row. This table has all the personal details of patients of the entire database. Then I have 3 different tables called โ€œLiverโ€, โ€œPancreasโ€, โ€œBiliary Tractโ€. All patients in โ€œPersonal Detailsโ€ table have been divided among these 3 tables based on the pathology they have (Liver diseases in โ€œLiverโ€ table, Pancreatic diseases in โ€œPancreasโ€ table and so on). Each of these 3 tables (Liver/Pancreas/Biliary Tract), has a separate โ€˜Keyโ€™ column that records exactly the unique ID of the patients extracted from the โ€œPersonal Detailsโ€ table as these 3 tables have been referenced as โ€˜Childโ€™ tables for the โ€œPersonal Detailsโ€ table which is the โ€˜Parentโ€™ table.

What I want to do is to isolate the Unique IDs in the โ€˜Keyโ€™ column of the โ€œLiverโ€ table from the entire set of Unique IDs in the โ€˜Keyโ€™ column of โ€œPersonal Detailsโ€ table using a SLICE, so that I can create various charts from the โ€œPersonal Detailsโ€ table for just โ€œLiverโ€ patients (A row filter condition in the Slice).
Can I do this? Appreciate your help!
Thank you very much.

0 4 299
4 REPLIES 4

Hey Malaka.

What Iโ€™ve done in the past is to create slices for each individual sub-group I wanted to create; so for your example youโ€™d create 3 slices (each of the Patients table):

Liver_Patients, Pancreas_Patients, and Biliary_Tract_Patients

To accomplish the slice filtering, you need a way to tell (on the patient level) whether or not someone has the presence of a โ€œLiverโ€ record, for example.

You said youโ€™ve got things split into separate tables, yes? Using a reference between them and the patient table?

Then we can use the presence of a record in the [Related Liver] column; for your slices, try something like this:

isnotblank([Related Liver])

One slice for each of the Related tables youโ€™ve got - so when someone creates a liver record, that patientโ€™s [Related Liver] column is no longer blank, and it will then show up in the Liver_Patients slice.

Hope that made sense.

Thank you so much for the reply.
I tried something else, and it kind of worked for me.
I had an intermediate table called โ€œDiagnosisโ€ in which the user could select whether patientโ€™s diagnosis is Liver related/pancreas related/biliary tract related using an Enum type column called the [Involved organ]. So this Diagnosis table was recording all the UniqueIDs from the parent table โ€œPersonal Detailsโ€, as it too was a child table of the โ€œPersonal Detailsโ€ parent table. And when the user selects โ€œLiverโ€ from the [Involved organ] Enum in the โ€œDiagnosisโ€ table, the app then opens up the โ€œLiverโ€ table (as I have referenced the โ€œLiverโ€ table to that โ€œDiagnosisโ€ table) so that the user can enter the liver pathology data at that point.
So what I did was, I created a virtual column in the parent table โ€œPersonal Detailsโ€ called [Involved organ_VC] to grab the [Involved organ] columnโ€™s data in the โ€œDiagnosisโ€ table. For this purpose, I wrote the following app formula.
INDEX(SELECT([Diagnosis][Involved organ],TRUE),1)

This made [Involved organ_VC] in the โ€œPersonal Detailsโ€ table to exactly act as the [Involved organ] column of the โ€œDiagnosisโ€ table that recorded either of the following three words โ€œLiverโ€, โ€œPancreasโ€, or โ€œBiliary Tractโ€ (the values Iโ€™ve included in the Enum column properties of the [Involved organ] column in โ€œDiagnosisโ€ table). So afterward, I simply isolated the โ€œLiverโ€ word in this [Involved organ_VC] that is now in the โ€œPersonal Detailsโ€ parent table using a row filter expression called [Involved organ_VC]=โ€œLiverโ€, and that isolated all the liver patients and from there on I could simply chart the gender distribution/age distribution and other parameters that were collected in the โ€œPersonal Detailsโ€ table pertaining to โ€œLiverโ€ patients.

I donโ€™t know what I did was prudent or not, but somehow it worked. Iโ€™m wondering if what youโ€™ve said could get the same results. Should check that out.

Thank you again for the reply. Appreciate it!

The way you went about it is exactly another way to do it! Thatโ€™s one of the best things about the AppSheet platform, thereโ€™s X number of ways to do anything.

When I was typing out my explanation, this was actually the first method that came to mind: create a flag on the patient level - then you can slice based on that.

But trying to explain the whole SELECT([Diagnosis][Involved organ],TRUE) thing can be complicated.

I would create [Liver_Flag] or something like that, and use:

in(โ€œLiverโ€, [Diagnosis][Involved organ])

Should give the same results - TRUE whenever thereโ€™s a Liver in the Involved Organs.

Happy it worked out!

Thank you so much!

Top Labels in this Space