Find Length of doc server script

Hello guys

I did a server script on employee promotion and this is my code.

  frappe.msgprint(doc.employee)
  doc_a = frappe.get_doc("Employee",doc.employee)
  if doc_a:
      x=doc_a.get("internal_work_history")
      frappe.msgprint("Hello")
    frappe.msgprint(x.length)

I want to print the length of the doc. How do get the length?

What is the syntax? Please help me.

Hi @jinsy,

len(x)

Thanks.

Thanks.
I updated this

frappe.msgprint(len(x))

but not displays the length of the doc

Do you work on the client-side or server-side?

Thanks.

Server Side.

Thanks

Then it works in server-side.

Try like

// eg.
x = "Hello"

//for terminal
print(len(x))

// for print
frappe.msgprint(len(x))

Thanks.