charles_douglas
15th July 2005, 22:32
i have a table zdaac900 which stores table and fieldname as below:
zdaac900.fld1 - tcmcs.str15 and it stores values like:
tdsls040.refa.c
tdsls040.refb.c
(The actual value stored in tdsls040.refa.c = "ABCD" and i want to access that)
how do i access the values stored in the fields after i select zdaac900 in the below way:
select zdaac900.*
from zdaac900
selectdo
here i want to access the values in tdsls040.refa.c i.e. ABCD and
than tdsls040.refb.c
than next row of zdaac900
endselect

Thanks in advance,

mark_h
15th July 2005, 23:00
Search on dynamic sql in this forum and see if it helps. You can take the table field from that Zdaac900 table and build a query against tdsls040.

charles_douglas
16th July 2005, 00:22
Thanks for the reply.

i guess i cant use dynamic SQL as there is nothing to be done on zdaac900. I want to access and check the value in tdsls040.refa.c or any other table_and_field name defined in zdaac900 as below:
select zdaac900.*
from zdaac900
selectdo
|* if first row has the value tdsls040.refa.c then
if tdsls040.refa.c(1;2) = "A" then
do something
endif
if tdsls040.refa.c(1;2) = "B" then
do something
endif
endselect
Than if the second row has the value tdsls040.refb.c then also do the above with tdsls040.refb.c.

so basically, how do i subsitute table.field in an "IF" or ON CASE statement


Any other inputs?

charles_douglas
18th July 2005, 19:23
Any inputs?
Thanks

mark_h
18th July 2005, 21:12
Can you set-up a cross-reference table instead of actually using a field name in the zdaac table? Like 1 means check tdsls040.refa.c and 2 means check tdsls040.refa.a. I can not think of a way to use the table name in an if statement like you suggest.

charles_douglas
18th July 2005, 21:45
Thanks Mark.

No I can't; as this will be maintained by administrators and they want to enter just the format "table_name.field_name". I am trying expr.compile...

but any other suggestions would be highly appreciated

JaapJD
19th July 2005, 09:52
Use get.var(pid, zdaac900.fld1, my.var). If zdaac900.fld1 contains "tdsls040.refa.c", the field my.var will contain the value of tdsls040.refa.c after execution of this statement.