2013-02-26 109 views
2

我有一个fetchXMl至极做一个简单的“和”查询。Dynamics CRM中2011 - 读取XML和返回NULL,而不是0

<fetch distinct='true' mapping='logical' aggregate='true'> 
    <entity name='orb_timesheetentry'> 
    <attribute name='orb_cost' alias='cost_sum' aggregate='sum'/> 
    <filter type='and'> 
     <condition attribute='orb_prepaidpack' operator='eq' value='{0}' /> 
     <condition attribute='statuscode' operator='eq' value='169810003' /> 
    </filter> 
    </entity> 
</fetch> 

的问题是,如果它没有找到任何记录,则返回0

而不是有没有办法返回0,而不是

+0

我有同样的问题 – 2014-11-12 17:24:01

回答

0

如果它是从C#执行:

return results ?? 0; 

如果它从JavaScript执行:

if(!results) 
    return 0; 
return results;