_Ralph_
15th February 2007, 20:02
Hi all.

I'm developing a program that allows users to insert data on table using an user interface.

This UI has 3 field:

table
field
data



Just an example :


function boolean input.data.on.table()
{
long table.id
string table.field(20), field.name(20)


table.id = db.bind("t"&field.table)
db.set.to.default(table.id)
|??????????????????
field.name = data
|??????????????????
db.insert(table.id)
}


but this way, won't work. As field.name is regonized as a variable.
Do you know somehow to "parse" a string with the table field name??
Something that works the same way as db.bind() for the table name..

is that possible??

my best regards

csecgn
15th February 2007, 20:45
Take a look at put.var(). With this command you can also fill table fields. But this is only half of the problem... . You also need special put.var for every data type. To evaluate the correct data type of a table field you need the rdi.* commands. It's a little complicate.

hth

Regards
Christof

rberti
15th February 2007, 21:00
Hello _Ralph_.

I could try use expr.compile to attribute values to the fields, and then use the db.insert.

for example:


id_sql = expr.compile(sql_slct_do)
err = l.expr(id_sql)
tbl_id = db.bind(tbl_name)
db.update(tbl_id, db.retry)
commit.transaction()
expr.free(id_sql)


Hope it helps!

regards

_Ralph_
16th February 2007, 12:50
Hello _Ralph_.

I could try use expr.compile to attribute values to the fields, and then use the db.insert.

for example:


id_sql = expr.compile(sql_slct_do)
err = l.expr(id_sql)
tbl_id = db.bind(tbl_name)
db.update(tbl_id, db.retry)
commit.transaction()
expr.free(id_sql)


Hope it helps!

regards

Thanks a lot for all replys.
rberti your solution work fine. I combine that with a Dynamic Sql and it works! Thanks guy!