dbr.report procedure name based on column value

(2 posts) (2 voices)
  1. brycedcamp, Member

    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?

  2. myDBR Team, Key Master

    Bryce,
    why not just use one linked report and pass the bolOpenPO as a parameter. You can then decide inside the report if you want to call sp_DBR_po_open_view01 or sp_DBR_po_history_view01 functionality.

    Also, it might be more efficient to do normal JOIN with ST2005.dbo.PO_TransactionHeader instead of row by row CASE statement.

    --
    myDBR Team


Reply

You must log in to post.