Hi Chris,
Have you read Melanies excellent primer on the subject?

Basically like you have it but IF arraydat.0(C) = 1 then....

/Henrik.