2014-04-23 49 views
0

CRM 2013-OnPremise是如何fetchXML最新的操作員通過系統解決

你好,

我已經被此fetchXML定義未來七天寫了一個基本的信息查看項目開始日期:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" > 
    <entity name="xxxx_project" > 
    <attribute name="xxxx_startdate" /> 
    <attribute name="xxxx_accountid" /> 
    <attribute name="xxxx_produom" /> 
    <order attribute="xxxx_name" descending="false" /> 
    <filter type="and" > 
     <filter type="and" > 
      <condition attribute="statecode" operator="eq" value="0" /> 
      <condition attribute="xxxx_projectstatus" operator="eq" value="331420009" /> 
      <condition attribute="xxxx_materialsshipdate" operator="null" /> 
      <condition attribute="xxxx_startdate" operator="next-x-days" value="7" /> 
     </filter> 
    </filter> 
    <attribute name="xxxx_projectid" /> 
    </entity> 
</fetch> 

現在我期待fetchXML有系統日期注入,或至少一個佔位符,如:

<condition value='2012-03-08T15:10:00Z' /> 

也許這個值是在運行時添加的,而不是fetchTemplate的一部分?因此,Msoft會對此進行一些運行時更改?

<condition attribute="xxxx_startdate" operator="next-7-days" value="2014-04-23" /> 

這篇文章說,這是注入http://social.microsoft.com/Forums/en-US/c5083689-65fb-474f-a7bc-2eff393016fe/datetime-on-or-after-of-fetchxml-questions?forum=crmdevelopment

但並沒有給我的那個應該是什麼樣的想法。

我問的原因是我想使用這個基本的fetchXML作爲模板,但注入了我選擇的日期。

有什麼想法?

回答

1

如果您希望根據您的日期動態構建模擬接下來的7天條件的fetchXML,您可以隨時使用On或Before和On或After條件來重寫它。 例如

<condition attribute="xxxx_startdate" operator="on-or-after" value="2014-04-23" /> 
<condition attribute="xxxx_startdate" operator="on-or-before" value=2014-04-30" /> 
+0

ahhhhh好的。那麼你知道這是Msoft在Next X days操作員幕後做了些什麼嗎? – GPGVM

+0

在運行時將fetchxml轉換爲查詢數據庫(在SQL中有不同的方法來完成此操作) –

+0

確定....但是如果它被轉換爲T-SQL,爲什麼不只是允許T-SQL或者至少有一個獲取Equiv。對於大多數T-SQL操作?我知道這是一個問題,可能需要一個水晶球來回答.---你剛剛完成的原始答案,並完美地產生了意見,這真是太棒了! – GPGVM