You realize you resurrected an almost 7 year old thread that had already a perfect solution presented, that is also shorter and more concise than what you propose?
Yes it was not marked as solution but I fixed that! 😀
Rolf Kalbermatter
My Blog 
DEMO, Electronic and Mechanical Support department, room 36.LB00.390