我正在研究以 XML 格式为某人导出 SSRS 报告,我们遇到了这样一种情况,即呈现的表 XML 包含详细信息行的每个实例的元素,但任何单元格为空,属性未添加到元素.
我更喜欢使用 ATOM 数据馈送输出,因为它更加健壮,但是他们坚持使用 XML 输出。
示例输出:
<Details DateStamp="2012-01-01" Customers="56703" Sales="624" />
<Details DateStamp="2012-02-01" />
<Details DateStamp="2012-03-01" Customers="107271" Sales="3195" />
有谁知道强制显示输出属性的任何方法,即使它们没有价值?或者这在 XML 格式中是不可能的?
理想情况下是这样的:
<Details DateStamp="2012-01-01" Customers="56703" Sales="624" />
<Details DateStamp="2012-02-01" Customer="" Sales="" />
<Details DateStamp="2012-03-01" Customers="107271" Sales="3195" />
试试这个查询数据集的例子:
SELECT
'2012-01-01' as [DateStamp]
,56703 as [Customers]
,624 as [Sales]
UNION ALL
SELECT
'2012-02-01' as [DateStamp]
,NULL as [Customers]
,NULL as [Sales]
UNION ALL
SELECT
'2012-03-01' as [DateStamp]
,107271 as [Customers]
,3195 as [Sales]