Problem with math calculations in grid

I am using JDOM api to construct the grid.
So, the header is constructed in java, one of the columns are defined like this:
…“Total Cost”, “ron[=c2c3]", "”)…
The values in 4th column is product of values in 2nd & 3rd columns.
When I add a new row (using grid.addRow(…)) & enter values, this formula works. But it doesn’t work when I change the values in the rows which are retrieved from the database.
Am I missing something?

Make sure that when you retrieve data from database in the forth column value is formula but not the num value.