FetchXML 或条件

发布于 2024-12-16 17:20:49 字数 2304 浏览 0 评论 0原文

我有一个 FetchXML 查询,因此如果参与类型掩码等于 5,那么它会将参与类型掩码为 5 的用户放入必需列中。但我还想添加它,因此如果用户的参与类型掩码为 6,那么它会将这些用户放入“可选”列中。这在 FetchXML 中可能吗?这是我到目前为止所拥有的。

<fetch>
      <entity name="appointment">
        <attribute name="scheduledstart" />
        <link-entity name="systemuser" from="systemuserid" to="ownerid" link-type="outer">
            <attribute name="firstname" alias="ownerFirstName" />
            <attribute name="lastname" alias="ownerLastName" />
        </link-entity>
        <link-entity name="contact" from="contactid" to="new_contactperson" link-type="outer">
            <attribute name="parentcustomerid" alias="parentaccount" />
            <attribute name="new_businessunit" alias="businessunit" />
        </link-entity>
        <attribute name="new_contactperson" />
        <attribute name="subject" />
        <attribute name="new_coldernotes" />
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer">
    <attribute name="participationtypemask" alias="participationtypemask" />
        <filter>
        <condition attribute="participationtypemask" operator="eq" value="5" />
        </filter>
        <link-entity name="contact" from="contactid" to="partyid" link-type="outer">
            <attribute name="firstname" alias="RequiredContactFirstName" />
            <attribute name="lastname" alias="RequiredContactLastName" />
        </link-entity>
        <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer">
            <attribute name="fullname" alias="RequiredOwners" />
        </link-entity>
        <link-entity name="account" from="accountid" to="partyid" link-type="outer">
            <attribute name="name" alias="RequiredAccount" />
        </link-entity>
    </link-entity>
        <filter type="and">
            <condition attribute="scheduledstart" operator="on-or-after" value="@FromDate" />
            <condition attribute="scheduledstart" operator="on-or-before" value="@ToDate" />
        </filter>
      </entity>
</fetch>

I have a FetchXML query and I have it so if participationtypemask equals 5 than it puts the users with a participationtypemask of 5 in the Required Column. But I also want to add it so if a user has a participationtypemask of 6 then it puts those users in the Optional column. Is this even possible in FetchXML? This is what I have so far.

<fetch>
      <entity name="appointment">
        <attribute name="scheduledstart" />
        <link-entity name="systemuser" from="systemuserid" to="ownerid" link-type="outer">
            <attribute name="firstname" alias="ownerFirstName" />
            <attribute name="lastname" alias="ownerLastName" />
        </link-entity>
        <link-entity name="contact" from="contactid" to="new_contactperson" link-type="outer">
            <attribute name="parentcustomerid" alias="parentaccount" />
            <attribute name="new_businessunit" alias="businessunit" />
        </link-entity>
        <attribute name="new_contactperson" />
        <attribute name="subject" />
        <attribute name="new_coldernotes" />
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer">
    <attribute name="participationtypemask" alias="participationtypemask" />
        <filter>
        <condition attribute="participationtypemask" operator="eq" value="5" />
        </filter>
        <link-entity name="contact" from="contactid" to="partyid" link-type="outer">
            <attribute name="firstname" alias="RequiredContactFirstName" />
            <attribute name="lastname" alias="RequiredContactLastName" />
        </link-entity>
        <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer">
            <attribute name="fullname" alias="RequiredOwners" />
        </link-entity>
        <link-entity name="account" from="accountid" to="partyid" link-type="outer">
            <attribute name="name" alias="RequiredAccount" />
        </link-entity>
    </link-entity>
        <filter type="and">
            <condition attribute="scheduledstart" operator="on-or-after" value="@FromDate" />
            <condition attribute="scheduledstart" operator="on-or-before" value="@ToDate" />
        </filter>
      </entity>
</fetch>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离不开的别离 2024-12-23 17:20:50

我个人一直很忙,所以很抱歉让您久等了,但我认为您所要做的就是使用适当的信息再次加入 link-entity Activity Party别名,如下。

<fetch>
  <entity name="appointment">
    <attribute name="scheduledstart" />
    <link-entity name="systemuser" from="systemuserid" to="ownerid" link-type="outer">
      <attribute name="firstname" alias="ownerFirstName" />
      <attribute name="lastname" alias="ownerLastName" />
    </link-entity>
    <link-entity name="contact" from="contactid" to="new_contactperson" link-type="outer">
      <attribute name="parentcustomerid" alias="parentaccount" />
      <attribute name="new_businessunit" alias="businessunit" />
    </link-entity>
    <attribute name="new_contactperson" />
    <attribute name="subject" />
    <attribute name="new_coldernotes" />
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer">
      <attribute name="participationtypemask" alias="participationtypemask" />
      <filter>
        <condition attribute="participationtypemask" operator="eq" value="5" />
      </filter>
      <link-entity name="contact" from="contactid" to="partyid" link-type="outer">
        <attribute name="firstname" alias="RequiredContactFirstName" />
        <attribute name="lastname" alias="RequiredContactLastName" />
      </link-entity>
      <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer">
        <attribute name="fullname" alias="RequiredOwners" />
      </link-entity>
      <link-entity name="account" from="accountid" to="partyid" link-type="outer">
        <attribute name="name" alias="RequiredAccount" />
      </link-entity>
    </link-entity>
    <!--the new join-->
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer" alias="optionalactivityparty">
      <attribute name="participationtypemask" alias="optionalparticipationtypemask" />
      <filter>
        <condition attribute="participationtypemask" operator="eq" value="6" />
      </filter>
      <link-entity name="contact" from="contactid" to="partyid" link-type="outer" alias="optionalcontact">
        <attribute name="firstname" alias="OptionalContactFirstName" />
        <attribute name="lastname" alias="OptionalContactLastName2" />
      </link-entity>
      <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer" alias="systemuser2">
        <attribute name="fullname" alias="OptionalOwners" />
      </link-entity>
      <link-entity name="account" from="accountid" to="partyid" link-type="outer" alias="optionalaccount">
        <attribute name="name" alias="OptionalAccount" />
      </link-entity>
    </link-entity>
    <filter type="and">
      <condition attribute="scheduledstart" operator="on-or-after" value="@FromDate" />
      <condition attribute="scheduledstart" operator="on-or-before" value="@ToDate" />
    </filter>
  </entity>
</fetch>

I personally have been busy, so sorry for the longer wait, but I think all you should have to do is make another join to the link-entity Activity Party with the appropriate aliases, as below.

<fetch>
  <entity name="appointment">
    <attribute name="scheduledstart" />
    <link-entity name="systemuser" from="systemuserid" to="ownerid" link-type="outer">
      <attribute name="firstname" alias="ownerFirstName" />
      <attribute name="lastname" alias="ownerLastName" />
    </link-entity>
    <link-entity name="contact" from="contactid" to="new_contactperson" link-type="outer">
      <attribute name="parentcustomerid" alias="parentaccount" />
      <attribute name="new_businessunit" alias="businessunit" />
    </link-entity>
    <attribute name="new_contactperson" />
    <attribute name="subject" />
    <attribute name="new_coldernotes" />
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer">
      <attribute name="participationtypemask" alias="participationtypemask" />
      <filter>
        <condition attribute="participationtypemask" operator="eq" value="5" />
      </filter>
      <link-entity name="contact" from="contactid" to="partyid" link-type="outer">
        <attribute name="firstname" alias="RequiredContactFirstName" />
        <attribute name="lastname" alias="RequiredContactLastName" />
      </link-entity>
      <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer">
        <attribute name="fullname" alias="RequiredOwners" />
      </link-entity>
      <link-entity name="account" from="accountid" to="partyid" link-type="outer">
        <attribute name="name" alias="RequiredAccount" />
      </link-entity>
    </link-entity>
    <!--the new join-->
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer" alias="optionalactivityparty">
      <attribute name="participationtypemask" alias="optionalparticipationtypemask" />
      <filter>
        <condition attribute="participationtypemask" operator="eq" value="6" />
      </filter>
      <link-entity name="contact" from="contactid" to="partyid" link-type="outer" alias="optionalcontact">
        <attribute name="firstname" alias="OptionalContactFirstName" />
        <attribute name="lastname" alias="OptionalContactLastName2" />
      </link-entity>
      <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer" alias="systemuser2">
        <attribute name="fullname" alias="OptionalOwners" />
      </link-entity>
      <link-entity name="account" from="accountid" to="partyid" link-type="outer" alias="optionalaccount">
        <attribute name="name" alias="OptionalAccount" />
      </link-entity>
    </link-entity>
    <filter type="and">
      <condition attribute="scheduledstart" operator="on-or-after" value="@FromDate" />
      <condition attribute="scheduledstart" operator="on-or-before" value="@ToDate" />
    </filter>
  </entity>
</fetch>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文