0

How filter records with same field value

Hello!

I got tables Treatments and Patients, with reference N:1 from Treatments to Patients.

Because each patient can have the same treatment various times through time, 
when i filter the treatment list for example by a "botox" procedure, i see many records for each patient. 

How can i see only one record of a procedure for each patient?
In other words - not show a record with the same patient name more then once?

 

Thank you very much!

Agassi

3 replies

null
    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    It depends on how you want the result to be presented. If you are happy with a field containing the list of unique treatments, you can put this in a formula field:

    concat(unique(Treatments.Name))

    or, if you want a multiline list:

    join(unique(Treatments.Name), "
    ")

    Also, nothing forbids to add a sort() function if you want the treatment names to be ordered.

    If what you need is a tabular view, I have no idea on how to do it in your two-tables database. It would be doable in a database with three tables, organizing a m:n relationship between Patients, and a table containing the list of all possible treatments. Such a database structure, admittedly more complex, would probably  have some other benefits.

    • Agassi
    • 3 yrs ago
    • Reported - view

    Alain, hello!
    Thank you very much for your answer!

    Yes, i need a tabular view, or a list view.

    Actually i have a third table with a list of treatments. Thanks for giving me direction.

    Best regards!!!

    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    Before considering a redesign of your database, there are some things you could try to see if they give acceptable results.

    1- create a list view in the Treatments table ; be sure to include at least a column with the treatment 'name', and a column with the patient name, by reference to the Patients table ; click on the header of the patient name column, and set the filter field to the name of a patient ; click on the header of the treatment name, and select the 'Grouped' option.

    2- in the Patients table, the default form view should contain a tabular view of the linked treatments ; you could click on the header of the treatment name colmun, and select the 'Grouped' option.

Content aside

  • 3 yrs agoLast active
  • 3Replies
  • 572Views