Unable to use Aggregation on CDT fields with many-to-many relationship.

Certified Senior Developer

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 table and mapping table as well to hold the relationship in database.

Requirement

I need to group the Campaigns based on Channels.

Issue

I am unable to use Aggregate functions on channels field in my Parent CDT - Campaign.

How can I achieve this using CDT relationships.

Thanks

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    first create the mapping table on both campaigns and channels 

    then Create a query rule to fetch the required data from campaigns associated with channels 

    a!queryEntity(
    entity: cons!YOUR_CAMPAIGN_ENTITY,
    filters: a!queryFilter(
    field: "id",
    operator: "IN",
    value: ri!campaignIds
    ),
    query: a!query(
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100),
    selection: a!querySelection(columns: {"id", "campaignName", "channel.id", "channel.channelName"}),
    filters: a!queryFilter(
    field: "channel.id",
    operator: "IS NOT NULL",
    value: ri!channelId
    )
    )
    )

    Once you retrieve the campaigns and associated channels, you can group the campaigns by their channel

    i hope this will use 

Reply
  • 0
    Certified Associate Developer

    first create the mapping table on both campaigns and channels 

    then Create a query rule to fetch the required data from campaigns associated with channels 

    a!queryEntity(
    entity: cons!YOUR_CAMPAIGN_ENTITY,
    filters: a!queryFilter(
    field: "id",
    operator: "IN",
    value: ri!campaignIds
    ),
    query: a!query(
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100),
    selection: a!querySelection(columns: {"id", "campaignName", "channel.id", "channel.channelName"}),
    filters: a!queryFilter(
    field: "channel.id",
    operator: "IS NOT NULL",
    value: ri!channelId
    )
    )
    )

    Once you retrieve the campaigns and associated channels, you can group the campaigns by their channel

    i hope this will use 

Children
No Data