How to get Single DocType Data

Hello,

I’m create a Single DocType. But there are no table created for this DocType.Where it store? Now, How can i get all data from Single DocType.

Single Doctype is in table “tabSingles” in db.

I think what you want is something like this:

frappe.db.get_value(…)

set the doctype to the name of your doctype, see below.

def get_value(self, doctype, filters=None, fieldname=“name”, ignore=None, as_dict=False, debug=False):
“”“Get a single / multiple value from a record.
For Single DocType, let filters be = None”“”

or: frappe.db.get(…)

set the doctype to the name of your doctype, see below.

def get(self, doctype, filters=None, as_dict=True):
return self.get_value(doctype, filters, “*”, as_dict=as_dict)

see this link: https://github.com/frappe/frappe/blob/develop/frappe/database.py

As an example:

frappe.db.get_value(“Item”, d.item_code, “is_stock_item”)

for more fields use a list: [“is_stock_item”, “this_item”, “that_item”]

1 Like

Thanks Luis,

It’s done now. :smile: