1

这甚至可能吗?

我已经有 fetch xml 来通过记录 id 从列表 A 中过滤列表 B,但是我还想要通过电子邮件地址过滤它的选项。

例如:

列表 A 有 2 条记录。记录 1:Bob@BobMail.com 和记录 2:Susy@SusyMail.com。列表 B 有 1 条记录。记录 3 Bob@BobMail.com 与记录 1 是不同的联系人,但具有相同的电子邮件地址。

还在我这儿?抱歉解释混乱...

查询应采用列表 A,与列表 B 进行外部连接以生成仅包含记录 2 和电子邮件地址 Susy@SusyMail.com 的结果。

如果有任何方法可以让我更清楚我正在尝试做什么,请不要犹豫。

4

1 回答 1

1

经过一夜的思考和早上一双新的眼睛后,我意识到我只需要将列表成员链接到联系人,就像我使用 by ID 选项一样,然后在联系人实体上添加一个附加链接电子邮件地址。

<fetch mapping="logical" version="1.0" page="1" count="100" >
<entity name="contact" >
    <link-entity name="listmember" from="entityid" to="contactid" >
        <filter>
            <condition attribute="listid" operator="eq" value="06197bff-a299-e311-aae4-6c3be5a892e8" />
        </filter>
    </link-entity>
    <attribute name="contactid" />
    <attribute name="emailaddress1" />
    <filter type="and" >
        <condition attribute="emailaddress1" operator="not-null" />
        <condition attribute="donotbulkemail" operator="ne" value="1" />
    </filter>
    <link-entity name="listmember" from="entityid" to="contactid" link-type="outer" alias="exclusionlist" >
        <attribute name="entityid" />
        <filter type="and" >
            <condition attribute="listid" operator="eq" value="06197bff-a299-e311-aae4-6c3be5a892e8" />
        </filter>
    </link-entity>
    <link-entity name="contact" from="emailaddress1" to="emailaddress1" link-type="outer" alias="emailaddress" >
        <attribute name="fullname" />
        <attribute name="emailaddress1" />
    </link-entity>
    <order descending="false" attribute="emailaddress1" />
</entity>

然后我们通过别名过滤掉结果:'

        results = results.Where(x => !x.Contains("exclusionlist.entityid") || !x.Contains("emailaddress.emailaddress1")).ToList();

希望这对其他人有所帮助,尽管我现在问起来确实有点愚蠢...

于 2014-03-05T15:54:42.183 回答