我正在使用FetxhXML,我希望条件大于一定的小时数。
这就是我所拥有的:
string groupby1 = "<fetch distinct='false' mapping='logical' aggregate='true'>" +
"<entity name='opportunity'>" +
"<attribute name='opportunityid' alias='opportunity_count' aggregate='countcolumn' />" +
"<filter type='and'>" +
"<condition attribute='new_leadstatus' operator='eq' value='100000000' />" +
"<condition attribute='new_emailedtorsm' operator='eq' value='false' />" +
"<condition attribute='ownerid' operator='not-null' />" +
"<condition attribute='createdon' operator='last-x-hours' value='1' />" +
"</filter>" +
"<attribute name='ownerid' alias='ownerid' groupby='true' />" +
"<link-entity name='systemuser' from='systemuserid' to='ownerid'>" +
"<attribute name='internalemailaddress' alias='internalemailaddress' groupby='true' />" +
"</link-entity>" +
"</entity>" +
"</fetch>";
所以基本上在创造条件下,我希望它比最后x小时大1小时或更长。这可能吗?
答案 0 :(得分:2)
您需要使用on-or-before条件并在当前时间之前一小时插入您自己的DateTime,如下所示:
string groupby1 = string.Format(@"
//snip...
<condition attribute='createdon' operator='on-or-before' value='{0}' />
//snip...
", DateTime.Now.AddHours(-1).ToUniversalTime().ToString("u"));