EQS to find nearest visible enemy

Greetings all,

currently working on a combat game and I used EQS for the ai to locate the nearest enemy, but a problem developed when they would target an enemy in cover while being shot by another enemy just a little ways off. I see that the EQS also has a visibly trace option, but I can’t seem to get it to work. All I need is for the EQS to locate the nearest visible enemy.

Thanks for your time.