Frappe.db.get_list

frappe.db.get_list return only 20 records but i want all records.
i getting only 20 records as per list.
how to get all records?

Your answer is in the docs.
https://frappeframework.com/docs/v13/user/en/api/database#frappedbget_list

@Rehan_Ansari You can use frappe.db.get_all() for fetching all records from database

page lenght is not working ??
it print only max 20 records…not more than that.

getting error can you send the code if you have?

frappe.ui.form.on(‘Transporter Items’, {
supplier:function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.db.get_list(‘Purchase Order’,
filters={
‘supplier’: “d.supplier”
},
fields=[‘name’],
start=10,
page_length=20,
as_list=True
).then(records => {
console.log(records);
})
}
})


getting error ??

I didn’t know you were using JS.
Try this:

frappe.db.get_list('Purchase Order', {
	filters: {
		supplier: d.supplier,
	},
	fields: ['name'],
	limit: 500,
}).then(res => {
	console.log(res)
});
5 Likes

@Rehan_Ansari
If you are doing with frappe.db.get_list you can use in JS as well as python but if you are using frappe.db.get_all() you can use this in Python code only.

frappe.db.get_list(‘Supplier’,page_length=30)

1 Like

okay will try in python
currently i am using in JS

thank you so much by adding limit i get all the records.
it works.
thanks again.

1 Like