Ronald,
I think the bit your missing is the "List" command, List used with a detect trigger will give you an array of all the enemy that have been spotted by any of your groups.
And yes your correct, the knowsabout command in a foreach loop will then let you determine which group has spotted a particular enemy.
P.S If you want to report unkown units rather than just enemy, you will have to set your trigger to detect Anybody. Then remove any soldiers from the result that are on your side.