Join Two Tables

SoudarapuN
Tera Contributor

Hi team,

I have a requirement where I need to display the number of records in one table that are associated with each record in a referenced table.

For example, Table A is a reference field in Table B. I want to show, for each record in Table A, how many related records exist in Table B.

Specifically, if Table A is the User table and Table B is the Incident table, I need to display how many incidents have been created by each user. The output should be in a list format showing each user along with the count of incidents associated with them.
it is not possible using reports aggregation.it is an urgent requirement.Please help if anyone knows
Thank you

12 REPLIES 12

Robert H
Mega Sage

Hello @SoudarapuN ,

 

You can either create a report/visualization of Incidents, grouped by "Opened by" and enable "Show data table"...

 

RobertH_0-1748355447210.png

 

... or run the following background script to print the same information:

 

var ga = new GlideAggregate('incident');
ga.groupBy('opened_by');
ga.addAggregate('COUNT');
ga.query();
while (ga.next()) {
	gs.print(ga.getDisplayValue('opened_by') + ' ' + ga.getAggregate('COUNT'));
}

 

Regards,

Robert

 

shun6
Giga Sage

Hi @SoudarapuN 

Click the dot icon next to the Created by label and select Group by Created by.

shun6_0-1748355711867.png

shun6_1-1748355737485.png

 

Thanks.

SoudarapuN
Tera Contributor

Thanks for your reply but i need like this 

 

 

SoudarapuN_0-1748355699295.png

Here for vendor 1 how many recalls are present like that i need to show 
please reply
Thank you

 

Hello @SoudarapuN ,

 

Your original post says you want the list of Users and the number of Incidents that they created.

 

Anyway, the solutions presented will work for your true requirement as well. Just run the report/script on the "Recalls" table, and group by "Vendor".

 

Regards,

Robert