我是 Pentaho 水壶的新手。
我需要使用表输入步骤的结果集生成 microsoft excel 输出。
我在转换中使用以下步骤
- 获取系统数据 - 为要检索的表数据提供日期范围
- 表输入 - SQL 根据上一步中给出的日期范围检索表数据
- Excel 输出 - 使用 step2 的结果集生成 Excel。
我的 excel 输出在列标题之前应该有 3 个空行。所以我尝试使用联合生成空行并使用 sql 构造列标题。但是如果我在 sql 中选择空行(所有字段值将被视为字符串),水壶不会对字段应用格式。
无论如何在列标题之前的excel输出中生成空行,而不会干扰我的结果集。
SELECT
'' AS 'Accounting Month', '' AS 'Insured Name','' AS 'Policy Number','' AS 'Company Name','' AS 'Line Of Business','' AS 'Transaction Type', '' AS 'Effective Date','' AS 'Rate','' AS 'Gross Premium','' AS 'Commission Amount', '' AS 'Expense Constant', '' AS 'Net Amount','' AS 'Payment Amount', 1 as ORDERS
UNION ALL
SELECT
'' AS 'Accounting Month', '' AS 'Insured Name','' AS 'Policy Number','' AS 'Company Name','' AS 'Line Of Business','' AS 'Transaction Type', '' AS 'Effective Date','' AS 'Rate','' AS 'Gross Premium','' AS 'Commission Amount', '' AS 'Expense Constant', '' AS 'Net Amount','' AS 'Payment Amount', 1 as ORDERS
UNION ALL
SELECT
'' AS 'Accounting Month', '' AS 'Insured Name','' AS 'Policy Number','' AS 'Company Name','' AS 'Line Of Business','' AS 'Transaction Type', '' AS 'Effective Date','' AS 'Rate','' AS 'Gross Premium','' AS 'Commission Amount', '' AS 'Expense Constant', '' AS 'Net Amount','' AS 'Payment Amount', 1 as ORDERS
UNION ALL
SELECT
'' AS 'Accounting Month', '' AS 'Insured Name','' AS 'Policy Number','' AS 'Company Name','' AS 'Line Of Business','' AS 'Transaction Type', '' AS 'Effective Date','' AS 'Rate','' AS 'Gross Premium','' AS 'Commission Amount', '' AS 'Expense Constant', '' AS 'Net Amount','' AS 'Payment Amount', 3 as ORDERS
UNION ALL
SELECT
'Accounting Month',
'Insured Name',
'Policy Number',
'Company Name',
'Line Of Business',
'Transaction Type',
'Effective Date',
'Rate',
'Gross Premium',
'Commission Amount',
'Expense Constant',
'Net Amount',
'Payment Amount',
2 ORDERS
UNION ALL
SELECT * FROM (
SELECT
CONCAT(ACCOUNT_YEAR,ACCOUNT_MONTH) AS 'Accounting Month',
INSURED_NAME AS 'Insured Name',
POLICY_NUMBER AS 'Policy Number',
COMPANY AS 'Company Name',
LINE_OF_BUSINESS AS 'Line Of Business',
TRANSACTION_DETAIL_TYPE 'Transaction Type',
DATE_FORMAT(CHANGE_EFFECTIVE_DATE,'%m/%d/%Y') AS 'Effective Date',
OWNER_COMMISSION_RATE AS 'Rate',
GROSS_PREMIUM AS 'Gross Premium',
OWNER_COMMISSION_AMOUNT AS 'Commission Amount',
EXPENSE_CONSTANT AS 'Expense Constant',
NET_AMOUNT AS 'Net Amount',
NET_AMOUNT AS 'Payment Amount' ,
4 ORDERS
FROM TABLE1
WHERE
DATE(TRANSACTION_ENTRY_DATE) >=?
AND
DATE(TRANSACTION_ENTRY_DATE) <=?
ORDER BY TABLE1.POLICY_NUMBER,TABLE1.FLAG,TABLE1.ENDORSEMENT_NUMBER
)T
ORDER BY ORDERS;