Accessing data from other doctype in a print format

I am trying to adapt the healthcare module to the workflows in our small hospital.

Specifically from the doctype Lab Test I wish to incorporate in a print format data from the Patient doctype.

Having read a number of posts then I understand that
{{frappe.db.get_value(“Patient”,doc.patient_name,“dob”)}} might work “Patient” is the target doctype, doc.patient_name is the patient name in the current doctype and “dob” the required fieldname.

With this and similar requests I consistently get the result “None”. I guess I am missing something in my understanding.

Can anyone help?

ill ask question you try to get child table in your print format.?

The tables are distinct but related through patient_name…does this help?

Hi, patient_name is a data field, you have to use the Link field patient.

frappe.db.get_value(“Patient”, doc.patient, “dob”)

this should fetch the dob.
Thanks

Thanks all I chose to customize the “Lab Test” form and add items from the linked patient doc. This seems to work fine.

Maybe this needs a new thread but I am trying to get the name details for the current user from the linked “user” doc and also get a “none” response.

User (24) is part of the standard Healthcare module, I have added Requester (25) both resolve to “none” in a print format! Both are read only.
Capture|690x216