From: Josselin Date: 2006-11-08T23:00:19+09:00 Subject: replacing a formula from a string I have a long formula expressed as a string formula_1 = "6366.00 * Math.acos(Math.cos(self.latitude) * Math.cos(latitude) * Math.cos(longitude -self.longitude) + (Math.sin(self.latitude) * Math.sin(LatitudeRad)) )" I need to use it in the preparation of some SQL query conditions like : condition += (c(:villes){ 6366.00 * Math.acos(Math.cos(self.latitude) * Math.cos(latitude) * Math.cos(longitude -self.longitude) + (Math.sin(self.latitude) * Math.sin(LatitudeRad)) ) < distance } ) How could I write it only once 'formula_1' and reuse it like : condition += (c(:villes){ formula_1 < distance }) # this is wrong as formula_1 is a string .. thansk for your suggestions joss