muheeb
7th August 2003, 17:05
Hello all,

I tried to use "import" after dynamic SQL in 3GL script
to retrieve the value of a given field, and I didn't succeed!
for example:
-------------------------------------------------------------------------
string data(100)
string field

field="tiitm001.item"
sql.parse("select "&field&" from tiitm001")
sql.exec(sql)
sql.fetch(sql)
import(field, data)
-------------------------------------------------------------------------
why I couldn't get in variable "data" the value in "tiitm001.item"

Thanks.

trchandra
7th August 2003, 17:55
Why do you want to use import() function? This function useful to access variables in other processes when they got exported. If you know the field name you can directly access it otherwise you should use expr.compile() to get the value based on the field. Look in the manual for detail usage of expr.compile().

regards

muheeb
7th August 2003, 17:58
No I don't know the field name directly, I get it in a string
variable from outside.

trchandra
7th August 2003, 17:59
Then use expr.compile().

Andre.A
11th August 2003, 10:33
Hi!
Why are you not using the selectbind command !

It looks like this:

string data(100)
string field
long sql_id

field = "tiitm001.item"
sql_id = sql.parse("select " & field &":1 from tiitm001")
sql.selectbind(sql_id, 1, data)
sql.exec(sql_id)
while sql.fetch(sql_id) = 0
sprintf$("%s",data)

endwhile

this example should work! cu

muheeb
11th August 2003, 10:40
Hi,

I know thid solution "selectbind", but "expr.compile" a lot

easy to use since "field" can also "*" and more than 1

field (a general SQL statment); then I have to attach ":1,:2,..."

for evey field.

Thanks anyway.