使用带有 IN 运算符的嵌套 fetchXML

问题描述 投票:0回答:1

我正在尝试在 Power Platform 环境中获取所有模型驱动应用程序,这些应用程序不属于任何解决方案。

我想使用 fetchXML 语句的结果作为另一个语句的输入条件,就像 SQL 中的嵌套 SELECT 语句一样。

我正在尝试将以下 SQL 转换为 fetchXML:

SELECT DISTINCT appmoduleid FROM solutioncomponent
   INNER JOIN appmodule ON appmodule.appmoduleid = solutioncomponent.objectid 
   WHERE componenttype = 80 AND solutioncomponent.objectid NOT IN 
      (SELECT DISTINCT objectid FROM solutioncomponent 
           WHERE componenttype = 80 AND NOT solutionid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' AND NOT solutionid = 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy' )

我认为 IN 运算符可能是一种可能性,并尝试了以下 fetchXML 语句,但它不起作用,所以我不确定这是否可能。

<fetch>
<entity name='solutioncomponent'>
<attribute name='objectid' />
<link-entity name='appmodule' to='objectid' from='appmoduleid' alias='appmodule' link-type='inner'>
  <attribute name='appmoduleid' />
</link-entity>
<filter>
  <condition attribute='componenttype' operator='eq' value='80' />
  <condition attribute='objectid' operator='not-in'>
    <fetch distinct='true'>
     <entity name='solutioncomponent'>
       <attribute name='objectid' />
       <filter>
         <condition attribute='componenttype' operator='eq' value='80' />
         <condition attribute='solutionid' operator='not-eq' value='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' />
         <condition attribute='solutionid' operator='not-eq' value='yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy' />
       </filter>
      </entity>
    </fetch>
   </condition>
</filter>
<order attribute='objectid' />
</entity>
</fetch>

我收到一条错误消息:

An exception System.FormatException was thrown while trying to convert input value 
'[REDACTED]' to attribute 'solutioncomponent.objectid'. Expected type of attribute 
value: System.Guid. Exception raised: Unrecognized Guid format.
nested fetchxml dataverse
1个回答
0
投票

您可能需要在

之后添加
<value>

标签
<condition attribute='objectid' operator='not-in'>

和之前

<fetch distinct='true'>

然后将

</value>
结束标记放在
</fetch>

之后
© www.soinside.com 2019 - 2024. All rights reserved.