How to use Groovy validate if a text type cell is not empty
Content
I have simple requirement to check if there is value in any period for a particular Account, there should be some remarks in the Comment field as well.
The simple groovy script below works perfectly fine if every cell is numeric. Yet since the Comment cell is of Text type, I got the error below when the groovy script was executed through the Planning form.
"A method called by the script failed on line: 9, with error: An error occurred while processing this page."
Anyone knows how this can be fixed?
Thanks!
Sunny
Code Snippet
def BackErrLightRedColor = 16755370 // Light Red DataGrid grid = operation.grid GridIterator itr = grid.dataCellIterator('OFS_Direct Input') itr.each{ DataCell hsComment = it.crossDimCell('HS_Comment') if(it.data != 0) { if(hsComment.data == '') { println(it.getMemberName('Entity') + " " + it.getMemberName('Account') + " has no Comment" ) hsComment.addValidationError(BackErrLightRedColor, "There should be value in Comment") } } }
0