Hi,
I am adding the small working project as attachment here, for anybody who might need this function.
 
Regards,
Paulo

Test_Count__2_.irpz

Is this article helpful for you?