I want to filter data on child table,
I’ve Child Table named ‘BS Tracking Reviews’
BS Tracking Reviews have field ‘balance_sheet’ which is linked to Doctype named ‘Heads’
in Heads i’ve field named ‘client’ and i also have ‘client’ field in Parent doctype named “Tracking Reviews”.
I want to filter Heads Data in Tracking Forms, according to clients.
I tried your solution for filter links data in child table and it pretty much worked for me. The bad thing which is happening is you have to manually select the option from the Link field.
A normal link field has all the data and works like a charm with suggestions when typing the name of data. It sorts too using like operator and so on.
I want this to happen in your solution too with suggestions when a user manually types the data.
@ROHAN_JAIN1
Hi rohan,
You can do this by adding like condition in your query.
E.g. frappe.db.sql("your query ......and month like '{1}' """.format('%%%s%%' % txt))
first do this in your js
frappe.call({
method:‘property_sales.property_sales.doctype.architect_certification_achieved.architect_certification_achieved.filter_serialno’,
freeze: true,
args: {
“project_name”: cur_frm.doc.project,
“building_name”: cur_frm.doc.building_name
},
callback: function(serialno){
console.log(serialno)
var includeinarray = []
@frappe.whitelist()
def filter_serialno(project_name,building_name):
sn_list = frappe.db.sql("""select pu.final_serial_number as name from `tabPlot Unit Price` as pu LEFT join `tabGenerate Sales Unit` as gs on gs.name=pu.parent where gs.project_name=%s and gs.sel_building_name=%s""",(project_name,building_name),as_dict=1)
return [x.name for x in sn_list]