当查询返回0结果并阻止#REF

时间:2016-06-02 13:33:47

标签: excel-formula dql alm

我有一个查看外部数据查询的公式(HP ALM业务视图)。

我正在使用的公式是;

   =IFERROR(VLOOKUP($B5,bvtbl_678a2f62_71fd_4e3e_bc63_7f1a176fae2d,2,FALSE),0)

可怕的长表名称我无法更改,因为它不会刷新Excel中的工具中的表格。无论如何,当表返回没有经常发生的结果时,表名被删除并替换为#REF!..由于报告的复杂性,我无法真正引用特定的单元格。我并不希望报告的用户每次数据表空白时都必须自己更新...

我的另一个选择是编写DQL查询,这样如果没有返回结果;

Select Defects.severity,
Sum(DECODE(Defects.status, 'Assigned', 1)) As Assigned,
Sum(DECODE(Defects.status, 'Awaiting Release', 1)) As "Awaiting Release",
Sum(DECODE(Defects.status, 'Being Resolved', 1)) As "Being Resolved",
Sum(DECODE(Defects.status, 'Blocked', 1)) As Blocked,
Sum(DECODE(Defects.status, 'Closed', 1)) As Closed,
Sum(DECODE(Defects.status, 'Deferred', 1)) As "Deferred",
Sum(DECODE(Defects.status, 'Failed Retest', 1)) As "Failed Retest",
Sum(DECODE(Defects.status, 'Fixed', 1)) As Fixed,
Sum(DECODE(Defects.status, 'Investigation', 1)) As Investigation,
Sum(DECODE(Defects.status, 'New', 1)) As New,
Sum(DECODE(Defects.status, 'Open', 1)) As "Open",
Sum(DECODE(Defects.status, 'Retest', 1)) As Retest
From Defects
Where Defects.user_template_06 = '07 - User Acceptance Testing (UAT)' 
And Defects.project = 'xxx'
Group By Defects.severity
Order By Defects.severity 

然后返回一个值...请注意这是DQL,这只是一个巨大的痛苦。

0 个答案:

没有答案