Accessing inner fields

Hi,

Am creating my own Print format , type : server

I want to print out the address manually.
So if i was to type {{ doc.address_display }} the address gets printed properly

How do I access the inner field for address. Eg country, city so i can have control over its placement. I tried {{ doc.address-display.city }} which I realized isn’t correct.

Try

frappe.get_doc("Address", doc.address).city

or

{% set address = frappe.get_doc("Address", doc.address) %}
{{ address.city }}

How can I access just the city and state of the shipping address? I tried different configurations like shipping_address.city and so on but it’s not working. On our PO’s, we need to print only the city and state but not full address.

try this:

{{ frappe.db.get_value("Address", {"name": doc.supplier_address}, "city") }}

Thanks so much! That worked!
I replaced supplier_address with shipping_address since that’s what I needed but it worked great. Thank you again!