Re. this question, and these answers; Note that one of the answers have since been deleted by the user, so you may need the required rep to view it.
The code given in the question worked correctly when tested, so the error cannot be diagnosed from the information given. The answer was then posted which improved the syntax and reduced verbosity of the OPs code, but would have made no difference to the outcome.
In this scenario is it valid to flag the answer as 'Not an answer'?
It would appear so, given that it would not help either the OP nor any future visitor to the question (even after the OP has found the issue and updated the question itself) - however it does help to educate others about logic improvements which could be made.