RE: Evaluar campos CHAR.
Posted in 1998
Okay here is a translation of what was asked. How to Evaluate fields of char type In the fields of type CHAR of a table of mine, I have the following: "20+5+(100/2)" , etc... How could I evaluate these fields to extract their values, for=20 example the before mentioned calculation would be: 75 Here is a simple solution. Not sure what kind of programs you are = running but here is a possible 4gl solution. It works too. The SELECT = statement needs to be from a valid table that will return at least one record. ------------------------------------------------------------------------= ---- --- DATABASE store MAIN DEFINE sql_stmt CHAR(100) DEFINE t_val INTEGER DEFINE part_num CHAR(8) LET calc_eq =3D "20+5+(100/2)" LET sql_stmt =3D " SELECT i_part, ", calc_eq CLIPPED, " from inv" PREPARE s1 FROM sql_stmt DECLARE test_curs CURSOR FOR s1 OPEN test_curs FETCH test_curs INTO part_num, t_val DISPLAY t_val END MAIN ------------------------------------------------------------------------= ---- --- Me gustaria presentarte una simple soluccion. No estoy seguro de que = tipos de programas estes usando pero e aqui una soluccion usando 4gl. Tambien trabaja. El uso del la funcion SELECT requiere ser de una tabla valida = la cual regresara por lo menos un disco, (record/entrada). -----Original Message----- From: jhernandez@geuropa.com [mailto:jhernandez@geuropa.com] Sent: Friday, September 25, 1998 3:06 AM To: informix-list@iiug.org Subject: Evaluar campos CHAR. Evaluar campos CHAR. En los campos de tipo CHAR de una tabla tengo grabado lo siguiente: "20+5+(100/2)" , etc... Como podr=EDa evaluar estos campos para sacar el valor, por ejemplo el = del anterior ser=EDa: 75. Muchas Gracias.