Retrieve tag associated with element

Hi everyone!

I´ve been trying to find a way to retrieve the corresponding tag associated to a tagged element (In this case pipe elements). But it seems I`ve hit a wall… Is there any simple method to retrieve this data? (My programming knowledge is quite limited). My final goal with this routine is to override the color of the corresponding tag.

Thank you in advance!

Hi,
How about something like this?
0 list. Element and tags.
1 list. elements without tags.

I`m sorry for the long absanse and thank you for the tips volkan.isik :smiley:
Anyway, here is what I ended up doing.