请注意,虽然这个问题是一个完全不同的问题,但它直接涉及到了 这个问题。
以下是返回SSRS图表数据集的脚本。
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
<entity name="account">
<attribute name="bio_employeesworldwide" alias="TotalWorldWideEmployees" aggregate="sum" />
<filter>
<condition attribute="customertypecode" operator="eq" value="2" />
</filter>
<link-entity name="contact" from="parentcustomerid" to="accountid" alias="contact">
<attribute name="bio_webuseraccountstatus" alias="count_bio_webuseraccountstatus" aggregate="countcolumn" />
<attribute name="bio_webuseraccountstatus" alias="bio_webuseraccountstatusgroupby" groupby="true" />
</link-entity>
</entity>
</fetch>
bio_webuseraccountstatus的值可以是: Active, Inactive, Disabled, Pending, etc..
在 FetchXML 中,是否有办法做一个 case 语句,让你对每个不等于 "Active "的值都 "InActive"?
如你所见,我一直在尝试解决这个问题。在报告层内但是遇到了很多 "字符串格式 "的问题。
能否用数据集层(fetchxml)来代替?
根据 这个微软论坛的帖子:
在FetchXml中没有对应的函数。相反,你需要返回每个字段的值,并在调用代码中处理CASE逻辑。如果这个FetchXml要在报表中使用,那么你可以在报表的计算字段中实现CASE逻辑。
你总是可以在返回时解析fetchxml的输出.因此,你不需要将isreceivetravelalerts的原始记录字段推送到屏幕、报表或db中,而是检查状态(0或1)并重写它,并将新变量添加到你的输出中。 虽然笨拙,但很有用。
if ($record->isreceivetravelalerts == 1)
{
$travel_alerts = "Active";
}
$travel_alerts = "Inactive";