之前写过一篇文章介绍SutieQL Query Tool,今天继续挖掘一下SuiteQL的价值。
NetSuite SuiteQL Query Tool_netsuite好用吗_毛岩喆的博客-CSDN博客这是一个非常好的NetSuite数据查询工具,免费、强大!所以忍不住安利给大家。首先介绍一下背景,SuiteQL是伴随SuiteAnalytics而来的一个基础组件,为NetSuite开发人员提供了一个按照SQL语法进行数据查询的工具。但是SuiteQL只有API供开发者使用,对于终端用户来说没有一个可用的UI工具。哪里有坑,哪里就有填坑人。所以,有个用户就基于SuiteQL组件开发了一个Bundle,赋予了其一个UI便于终端用户使用。好了,闲言少叙,上硬菜!https://blog.csdn.net/remottshanghai/article/details/127032699SuiteQL中有几个内建函数(Built-In),可以帮助我们在编写SQL语句时更加的方便。并不详细的介绍可以参见在线帮助。
NetSuite Applications Suite - SuiteQL Supported Built-in Functionshttps://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_161950565221.html今朝我们用一个SQL语句来综合实践一下:
SELECT
Transaction.TranID,
Transaction.trandate,
Transaction.postingPeriod,
TransactionAccountingLine.Account,
BUILTIN.DF( TransactionAccountingLine.Account ) AS func_df,
TransactionAccountingLine.Debit,
TransactionAccountingLine.Credit,
BUILTIN.CONSOLIDATE(TransactionAccountingLine.Credit, 'INCOME', 'DEFAULT', 'DEFAULT', 3, 263, 'DEFAULT') as func_consolidate,
BUILTIN.CURRENCY(TransactionAccountingLine.Credit) as func_currency,
BUILTIN.CURRENCY_CONVERT(TransactionAccountingLine.Credit, 1) as func_currency_convert,
BUILTIN.DF( TransactionLine.Subsidiary ) AS Subsidiary,
BUILTIN.HIERARCHY(TransactionLine.Subsidiary, 'DISPLAY_JOINED') AS func_hierarchy
FROM
Transaction
INNER JOIN TransactionAccountingLine ON
( TransactionAccountingLine.Transaction = Transaction.ID )
LEFT OUTER JOIN TransactionLine ON
( TransactionLine.Transaction = TransactionAccountingLine.Transaction )
AND ( TransactionLine.LineSequenceNumber = TransactionAccountingLine.TransactionLine )
WHERE
--Transaction.trandate >= BUILTIN.RELATIVE_RANGES('TY', 'START')
Transaction.postingPeriod in BUILTIN.PERIOD('LFY', 'START', 'ALL', '>')
AND ( TransactionAccountingLine.Account IS NOT NULL )
ORDER BY
Transaction.trandate
在这段语句中,我们涉及了如下几个函数:
- BUILTIN.DF( TransactionAccountingLine.Account )
- BUILTIN.CONSOLIDATE(TransactionAccountingLine.Credit, 'INCOME', 'DEFAULT', 'DEFAULT', 3, 263, 'DEFAULT')
- BUILTIN.CURRENCY(TransactionAccountingLine.Credit)
- BUILTIN.CURRENCY_CONVERT(TransactionAccountingLine.Credit, 1)
- BUILTIN.HIERARCHY(TransactionLine.Subsidiary, 'DISPLAY_JOINED')
- BUILTIN.RELATIVE_RANGES('TY', 'START')
- BUILTIN.PERIOD('LFY', 'START', 'ALL', '>')
运行结果如下:
由于严重缺乏支持材料,还有两个函数,不清楚如何使用。
- CF
- NAMED_GROUP
有清楚的同学请跟帖分享一下,谢啦!
如果有任何关于NetSuite的问题,欢迎来谈。我的邮箱:rick.mao@truston.group