Join Two Aggregates
Question

I have two aggregates one is rendering the tasks I have assigned to a campaign and another is rendering the goals I have assigned to a task which is assigned to a campaign.

I have to show all the goals in a row with particular task and campaign in a table so if I use two aggregates the data would not be synchronized so is there any way to join two aggregates like tables.


So you can apply join between Tasks and Goals tables. Please provide entity structure if facing issue.

Yes indeed I can do that but by doing this each tasks have multiple goals so the tasks are repeating along with their campaigns show each goal to each row but i want all goals to clubbed with their tasks and campaigns in a single row

If you want to show tasks and campaigns in the single row so I would suggest you to go with SQL query and in SQL use STUFF to show multiple tasks and campaigns  in a single row.

https://stackoverflow.com/questions/31211506/how-stuff-and-for-xml-path-work-in-sql-server


Hi Anurag Singh,

You can Use a Structure with a list append in data action, to build the logic according to your use-case then assign that list output as a source to the table or list widget that you're using to visualize the data on the screen. 

Hope this helps!

Regards,

Saravanan Santhanam.

mvp_badge
MVP

Hi Anurag,

There's I think two ways you can go about this. The first is the most straight forward, but may be slower because of more queries (although presentation to the user is faster). The second is a bit more fiddling in the screen, but you can suffice with a single query.

  1. Use a table with as input the tasks Aggregate. In one of the columns, put a Block that has the TaskId as input. Inside the block put an Aggregate that retrieves the goals based on the TaskId, and display them.
  2. Use a single Aggregate that retrieves all the tasks with their goals, sorted on tasks. Use Ifs to only show the task name once (and surpress it in the 2nd etc. row), and use CSS to hide borders as to make the rows in that column to appear as a single cell (for a single task).
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.