0

如何将“词法参数”(用于 Oracle 报告)之类的参数用于 Pentaho 报告。

以下是我的 oracle 报告查询和“AFTERFORM”触发代码
SELECT FEI.CUSTOMER_NAME ,CASE WHEN FEI.OWNBRANCH_CUSTOMER = 0 THEN FEI.LC_NO || ' CTPU' ELSE FEI.LC_NO END LC_NUMBER ,A.OUTSTANDING ,CR_APPR_REF_NO ,MARGIN_REALIZED_AMT_CCY ,DECODE (SIGN ( MARGIN_BUILD_AMT - MARGIN_SET_AMT) ,'-1', 0 , (MARGIN_BUILD_AMT - MARGIN_SET_AMT)) SHORTFALL FROM IMPORT_LC FEI ,CURRENCY FEC , (SELECT LOGIN_BRANCH, REFERNCE_NO, ABS ( SUM ( AMOUNT_DR) - SUM ( AMOUNT_CR)) OUTSTANDING FROM TRANSACTIONS WHERE GLOBAL_TRANS_NO IS NOT NULL AND PRODUCT_CODE = :P_PRODUCT_CODE AND LOGIN_BRANCH = NVL ( :P_REPORT_BRANCH, LOGIN_BRANCH) AND TRANS_DATE <= :P_TRANS_DATE AND GLCODE = :P_LIAB_ACC HAVING ABS ( SUM ( AMOUNT_DR) - SUM ( AMOUNT_CR)) > 0 GROUP BY LOGIN_BRANCH, REFERNCE_NO) A WHERE A.LOGIN_BRANCH = FEI.OWN_BRANCH AND A.REFERNCE_NO = FEI.LC_NO AND FEI.IMP_AMEND_NO = (SELECT MAX ( FF.IMP_AMEND_NO) FROM IMPORT_LC FF WHERE FF.LC_NO = FEI.LC_NO AND FF.OWN_BRANCH = FEI.OWN_BRANCH) AND FEI.OWN_BRANCH_CODE = NVL ( :P_REPORT_BRANCH, FEI.OWN_BRANCH) AND FEI.CUSTOMER_CODE = NVL ( :P_CUST_CODE, FEI.CUSTOMER_CODE) AND FEI.IMP_CURR_CODE = FEC.CUR_CODE AND FEI.PRODUCT_CODE = :P_PRODUCT_CODE &P_W
Where after parameter form trigger我将 where 子句的值设置为:

    BEGIN  
      IF  :P_TRANS_DATE < GET_CURRENT_DATE THEN
        :P_W :='';
      ELSE
        :P_W :=' AND  FEI.LC_STATUS   <>6 and  FEI.OPERATION_CODE<>'20' ';
      END IF;

      :P_W:=:P_W||CASE WHEN :P_OTHER_BRANCH=1 
                    THEN ' AND FEI.OWN_BRANCH=FEI.CUSTOMER_BRANCH ' 
              ELSE' AND FEI.OWN_BRANCH<>FEI.CUSTOMER_BRANCH ' 
              END;  
    END;

我想在Pantaho中部署此查询,但作为 Pantaho 的初学者,如何在其中实现词法参数部分...

4

1 回答 1

0

通常,您可以使用类似的参数${PARAM}

如果你想包含这样的词法参数select 'You chose the number ' || &myparm from dual; -- Oracle。然后&myparm可以作为变量添加到 Pentaho 中VAR1=&myparm,您可以${VAR}在发送查询时使用。所以 &myparm 将被发送到 Oracle。

如果这不是您想要的,那么您可能必须在您的问题中提供更多详细信息。

于 2017-11-23T16:53:40.287 回答