Skip to main content

How can i write an expression/query so it’s possible to search on multiple suppliers? Right now my Quick Report only works when one supplier is searched on. 

See image:

Quick Report

select sig.supplier_id
          , sig.name AS "Supplier Account Name"
          , sia.address_id
          , sia.name AS "Supplier Name"
          , sia.country
          , sia.address
          , sia.address1 
          , sia.address2
          , sia.address3
          , sia.zip_code
          , sia.city
          , se.buyer_code
          , PURCHASE_BUYER_API.GET_NAME(se.BUYER_CODE) AS "Buyer Name"
          , PURCHASE_CODE_API.Get_Description(se.PURCHASE_CODE) AS "Supplier Category"
          , cm.name
          , cm.description
          , cm.method_id
          , cm.value
          , cm.method_default
          , cm.address_default
          , cm.valid_from
          , cm.valid_to
from supplier_info_general sig
        left outer join supplier_info_address sia on sig.supplier_id = sia.supplier_id
        left outer join supplier_ent se on sig.supplier_id = se.supplier_id
        left outer join comm_method cm on sig.supplier_id = cm.identity

--Below are my search criterias
WHERE (Report_sys.Parse_parameter(sig.supplier_id, '&SupplierID') = 'TRUE' or '&SupplierID' is null)
and (UPPER(sia.name) like UPPER('&SupplierName') or UPPER('&SupplierName') is null)
and (UPPER(PURCHASE_BUYER_API.GET_NAME(se.BUYER_CODE)) like UPPER('&BuyerID') or UPPER('&BuyerID') is null)
and (UPPER(PURCHASE_CODE_API.Get_Description(se.PURCHASE_CODE)) like UPPER('&SupplierCategory') or UPPER('&SupplierCategory') is null)

Hi @Christian Cordius ,

 

You could change your query to use the IN clause and enter a supplier list instead.

When the users enter the supplier id list they would enter it as follows:   ‘10322’,’10323’

select sig.supplier_id
, sig.name AS "Supplier Account Name"
, sia.address_id
, sia.name AS "Supplier Name"
, sia.country
, sia.address
, sia.address1
, sia.address2
, sia.address3
, sia.zip_code
, sia.city
, se.buyer_code
, PURCHASE_BUYER_API.GET_NAME(se.BUYER_CODE) AS "Buyer Name"
, PURCHASE_CODE_API.Get_Description(se.PURCHASE_CODE) AS "Supplier Category"
, cm.name
, cm.description
, cm.method_id
, cm.value
, cm.method_default
, cm.address_default
, cm.valid_from
, cm.valid_to
from supplier_info_general sig
left outer join supplier_info_address sia on sig.supplier_id = sia.supplier_id
left outer join supplier_ent se on sig.supplier_id = se.supplier_id
left outer join comm_method cm on sig.supplier_id = cm.identity

--Below are my search criterias
WHERE sig.supplier_id IN (&SupplierID_List)
and (UPPER(sia.name) like UPPER('&SupplierName') or UPPER('&SupplierName') is null)
and (UPPER(PURCHASE_BUYER_API.GET_NAME(se.BUYER_CODE)) like UPPER('&BuyerID') or UPPER('&BuyerID') is null)
and (UPPER(PURCHASE_CODE_API.Get_Description(se.PURCHASE_CODE)) like UPPER('&SupplierCategory') or UPPER('&SupplierCategory') is null)

 

Regards,

William Klotz


Hi @Christian Cordius 

 

you are missing the query flags in the parameter 😉

change the condition to accept supplier IDs as below

WHERE (&AO.Report_sys.Parse_parameter(sig.supplier_id, '& MC--L]SupplierID') = 'TRUE' 

 

read more on query flags

Development of Quick Reports (ifs.com)

Is there a way to allow multiple end user inputs for Quick Report Parameters? | IFS Community

 

Cheers!

Damith


Hi @dsj 

Thanks for above answer. Wasn’t aware of Query Flags until now. I’ve added them and it works perfectly!! Thanks for helping me out and knowledge sharing :)

Cheers!