Research notes in Flex Header

Hello All,

I'm working on setting up Flex Headers in preparation for v16 and am struggling a bit with my limited knowledge of SQL to create a custom element that will display an icon when a specific note type is present on the record.

We had this element in our Infomaker headers but it's not working as a direct copy over.  

Anyone willing to tell me why my SQL isn't working here or share your SQL if you have a similar custom element in your database?

Select top 1 note_type from dbo.lv_sct_notes where note_type=6 and customer_no = @customer_no

It is returning the icon, but unfortunately it's returning the icon for every constituent in our database regardless if they have the note or not.

Thanks for your help!

Kanani