How to hide column from a!gridField()

I am trying to hide a column from a!gridField() if certain condition is met using an IF statement. It is not working for me. Please see the document attached for details and the error message I am getting

supporting_document.txt

OriginalPostID-197530

OriginalPostID-197530

  Discussion posts and replies are publicly visible