Create Variables Counter

Create Variables Counter

Hi all,
Could anyone help me?
I want to make a function, addin, or logic (IEC 61131-3) to count the number of variables based on their identification in the engineering studio, and the total counted number appears in the service engine as dynamic text.