Query report filters using fields not present in document

Hi All,
How to filter the query report by fields that are not in document.
Ex: Item group field is not available in Production Order but I want to filter the below query report depending on item to manufacture in production order.

SELECT
tabProduction Order.posting_date as “Posting Date:Date/Date:90”,
tabProduction Order.name as “Production Order:Link/Production Order:140”,
tabProduction Order.cycle as “Cycle:Link/Cycle:70”,
tabProduction Order.production_item as “Item To Produce:Link/Item:110”,
tabProduction Order.qty as “To Produce:Int:75”,
tabProduction Order.produced_qty as “Produced:Int:70”,
tabProduction Order.bom_no as “BOM No:Link/BOM:160”,
tabProduction Order.naming_series as “Input Item:Link/Item:90”,
tabProduction Order.wip_warehouse as “Source Warehouse:Link/Production Order:155”,
tabProduction Order.fg_warehouse as “Destination Warehouse:Link/Production Order:155”,
tabProduction Order.planned_start_date as “Planned Date:Datetime/Production Order:120”

FROM
tabProduction Order,
tabItem

WHERE
posting_date>=%(from_date)s and posting_date<=%(to_date)s
&& item_group=%(tabItem.item_group)s

.js file is:

{
“fieldname”:“item_group”,
“label”:(“Item Group”),
“fieldtype”:“Link”,
“options”:“Item”
}

In above query report item_group=%(tabItem.item_group)s is not working.
Can anyone help me to achieve this.

Hii
I believe instead of

item_group=%(tabItem.item_group)s
it should be
tabItem.item_group=%(item_group)s

Try that and check if it works :slight_smile:

2 Likes

Yes, it works. Thank you.