<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Unable to use Aggregation on CDT fields with many-to-many relationship.</title><link>https://community.appian.com/discussions/f/data/38552/unable-to-use-aggregation-on-cdt-fields-with-many-to-many-relationship</link><description>Hi, 
 
 Am unable to use aggregate functions on child CDT having many to many relationships with parent CDT. 
 Background 
 I have a parent CDT called Campaign which has many to many relationship with child CDT called Channel. I have Campaign table, Channel</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Unable to use Aggregation on CDT fields with many-to-many relationship.</title><link>https://community.appian.com/thread/145526?ContentTypeID=1</link><pubDate>Fri, 21 Feb 2025 20:29:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c6971109-0829-4dc1-9290-738d47de065a</guid><dc:creator>vikrantb</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;We already have a mapping table between campaign and marketing channel to store the many to many relationship.&lt;/p&gt;
&lt;p&gt;Even filtering on channel value is not working.&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;p&gt;a!localVariables(&lt;br /&gt; local!data:&lt;br /&gt; a!queryEntity(&lt;br /&gt; entity: cons!MSS_ENTITY_CAMPAIGN_REQUEST,&lt;br /&gt; query: a!query(&lt;br /&gt; logicalExpression: a!queryLogicalExpression(&lt;br /&gt; operator: &amp;quot;AND&amp;quot;,&lt;br /&gt; filters: {&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;marketingChannels.value&amp;quot;,&lt;br /&gt; operator: &amp;quot;in&amp;quot;,&lt;br /&gt; value: ri!channel&lt;br /&gt; )&lt;br /&gt; },&lt;br /&gt; ignoreFiltersWithEmptyValues: true&lt;br /&gt; ),&lt;br /&gt; pagingInfo: ri!pagingInfo&lt;br /&gt; ),&lt;br /&gt; fetchTotalCount: true&lt;br /&gt; ),&lt;br /&gt; local!data&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;Error:&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;div class="SplitPaneLayout---pane SplitPaneLayout---secondary_pane"&gt;
&lt;div class="SplitPaneLayout---contents"&gt;
&lt;div class="TabButtonGroup---tab_group TabButtonGroup---inHeaderBodyLayout"&gt;
&lt;div class="TabButtonGroup---tab_contents_container TabButtonGroup---flush"&gt;
&lt;div class="ContentLayout---content_layout ContentLayout---padding_less"&gt;
&lt;div class="SectionLayout2---sectionLayout SectionLayout2---margin_above_none"&gt;
&lt;div class="CollapsibleElement---collapsible"&gt;
&lt;div class="SectionLayout2---section_contents SectionLayout2---margin_below_standard" data-testid="SectionLayout2-contentContainer"&gt;
&lt;div class="MessageLayout---message MessageLayout---error"&gt;
&lt;p class="ParagraphText---richtext_paragraph ParagraphText---default_direction ParagraphText---align_start ParagraphText---inMessageLayout ParagraphText---error elements---global_p" data-testid="ParagraphText-paragraph"&gt;Expression evaluation error at function a!queryEntity [line 3]: Cannot filter by field [marketingChannels.value] because it is a complex, multiple, or child of a multiple data type.&lt;/p&gt;
&lt;p class="ParagraphText---richtext_paragraph ParagraphText---default_direction ParagraphText---align_start ParagraphText---inMessageLayout ParagraphText---error elements---global_p" data-testid="ParagraphText-paragraph"&gt;Thanks&lt;/p&gt;
&lt;/div&gt;
&lt;div class="ColumnArrayLayout---column_layout ColumnArrayLayout---standard_spacing appian-context-last-in-list"&gt;
&lt;div class="ColumnLayout---column ColumnLayout---column_padding_standard ColumnLayout---align_start ColumnLayout---top ColumnLayout---width_auto ColumnLayout---stack_when_phone appian-context-last-in-list" data-padding-left="0" data-padding-right="-20" data-stacked="false" data-divider="false"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="SplitPaneLayout---separator SplitPaneLayout---horizontal SplitPaneLayout---resizable"&gt;
&lt;div class="SplitPaneLayout---default_direction SplitPaneLayout---collapse_control_parent SplitPaneLayout---parent_horizontal SplitPaneLayout---collapse_control_parent_right"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to use Aggregation on CDT fields with many-to-many relationship.</title><link>https://community.appian.com/thread/145512?ContentTypeID=1</link><pubDate>Fri, 21 Feb 2025 07:43:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9447e0d9-01f6-4a82-a1be-e5ae1b2eb27f</guid><dc:creator>lalithyak07</dc:creator><description>&lt;p&gt;first create the mapping table on both campaigns and channels&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then Create a query rule to fetch the required data from campaigns associated with channels&amp;nbsp;&lt;/p&gt;
&lt;p&gt;a!queryEntity(&lt;br /&gt; entity: cons!YOUR_CAMPAIGN_ENTITY,&lt;br /&gt; filters: a!queryFilter(&lt;br /&gt; field: &amp;quot;id&amp;quot;, &lt;br /&gt; operator: &amp;quot;IN&amp;quot;, &lt;br /&gt; value: ri!campaignIds&lt;br /&gt; ),&lt;br /&gt; query: a!query(&lt;br /&gt; pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100),&lt;br /&gt; selection: a!querySelection(columns: {&amp;quot;id&amp;quot;, &amp;quot;campaignName&amp;quot;, &amp;quot;channel.id&amp;quot;, &amp;quot;channel.channelName&amp;quot;}),&lt;br /&gt; filters: a!queryFilter(&lt;br /&gt; field: &amp;quot;channel.id&amp;quot;,&lt;br /&gt; operator: &amp;quot;IS NOT NULL&amp;quot;,&lt;br /&gt; value: ri!channelId&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;Once you retrieve the campaigns and associated channels, you can group the campaigns by their channel&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i hope this will use&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>