我正在从CRM中检索数据。我想从quotedetail
中检索几个字段。其中之一是int
字段ad_discountpercent
。检查是否检索到数据 - CRM
此字段不必具有值。
我需要检查是否有从该字段中检索到的某个值,如果没有值,则将其设置为默认值0
。
这里是我的代码:
string fetch1 = @"
<fetch count='50' >
<entity name='quotedetail' >
<attribute name='manualdiscountamount' />
<attribute name='priceperunit' />
<attribute name='ad_discountpercent' />
<attribute name='quantity' />
<attribute name='extendedamount' />
</entity>
</fetch>";
EntityCollection result = service.RetrieveMultiple(new FetchExpression(fetch1));
foreach (var c in result.Entities)
{
if(...)
}
我应该怎么放,而不是(...)
看看是否有任何数据检索,并给一个默认值?如果你知道这两件事情,这将是有益的。
让我知道你是否需要一些额外的信息。
什么是结果类型? –
这取决于你在<>括号里有什么。我想你想'c.GetAttributeValue(“ad_discountpercent”)':) –
Nick