In reply to grey:
Please use code tags making your code easier to read. I have added them for you.
Again, without a complete example showing your issue, it’s difficult to make any recommendations.
Are you getting a syntax error? Unexpected behavior? Something else?