1

鉴于此查询(为便于阅读而添加间距):

rest-1.v1\Data\Story?
    sel=
        Children.ID,
        Children.Actuals.Value,
        Children:Task.@Count,
        Children.Actuals.Value.@Sum.Value
    &where=Number='B-02833'

我收到以下回复:

<Assets total="1" pageSize="2147483647" pageStart="0">
    <Asset href="/rest-1.v1/Data/Story/13195" id="Story:13195">
        <Relation name="Children.ID">
            <Asset href="/rest-1.v1/Data/Task/34505" idref="Task:34505"/>
            <Asset href="/rest-1.v1/Data/Task/34506" idref="Task:34506"/>
            <Asset href="/rest-1.v1/Data/Task/34507" idref="Task:34507"/>
        </Relation>
        <Attribute name="Children.Actuals.Value.@Sum">97.2</Attribute>
        <Attribute name="Children.Actuals.Value">
            <Value>1</Value>
            <Value>2</Value>
        </Attribute>
        <Attribute name="Children:Task.@Count">6</Attribute>
    </Asset>
</Assets>

有人可以解释为什么返回的值总计为 3,但 .@Sum 显示为 97.2?

4

1 回答 1

2

最可能的原因是聚合函数喜欢@Sum并且@Count不会自动忽略已删除/死资产。

你可能想说这样的话:

rest-1.v1\Data\Story?
    sel=
        Children.ID,
        Children.Actuals.Value,
        Children:Task[AssetState!=Dead].@Count,
        Children[AssetState!=Dead].Actuals.Value.@Sum.Value
    &where=Number='B-02833'
于 2012-12-19T19:41:18.490 回答