如何使用"词法参数"等参数。对于Pentaho报告

时间:2017-11-22 12:23:56

标签: pentaho pentaho-report-designer

如何使用"词法参数"等参数。 (用于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子句的值设置为:

    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 的初学者,如何在其中实现Lexical参数部分......

1 个答案:

答案 0 :(得分:0)

通常,您可以使用select 'You chose the number ' || &myparm from dual; -- Oracle

等参数

如果要包含像&myparm这样的词法参数。然后可以在Pentaho VAR1=&myparm中将${VAR}添加为变量,您可以在发送查询时使用{{1}}。因此&amp; myparm将被发送到Oracle。

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