ERPNext Print Format 'str' is Undefined

So I was trying to use the str.isDigit function to filter some values but it seems str is undefined here. How do I get around this?