I have a need to reference a different procedure/report depending upon whether or not a Purchase order is open or closed. Detecting the difference between each PO is easy in the DB and I can create a column with the correct procedure to call:
CASE
WHEN (SELECT bolOpenPO FROM ST2005.dbo.PO_TransactionHeader AS aaa WHERE aaa.strPONumber=a.strPONumber) = 1 THEN 'sp_DBR_po_open_view01'
ELSE 'sp_DBR_po_history_view01'
END AS [POReport],
I am trying to use the [POReport] value in the mydbr.report command as the procedure name to call:
select 'dbr.report', '[POReport]', '[strPONumber]', 'popup', 'instrPONo=strPONumber';
But this doesn't work - the linked report functionality stops working until I define the actual report name which defeats the purpose.
How can I make this work?