putting fix values dynamically while extracting

shafee212

Member
can any one help me out on this

i have made a dynamic program which accepts table name and its fileds from user and extracts data for respectice fields.

but one more req has been added that is to input whether the value is fixed for cretain filed and if fixed then input tha fixed value . and then porpagate the fix value to the entire column of those fields.

what i need is to modify field values to fix valued for those which are marked as fix

a fragment of my code is as follows

-----------------------------------------------------------------------


FOR EACH tttable no-lock: / * tttable is temp table with fields f1, f2, f3 , f4 */ f3 is assigned as checked or not , f4 is assined as if checked , then value ./* f2 containd fileds names .
IF count = 0 THEN DO:
m_line2 = f2.
END.
ELSE
DO:
m_line2 = m_line2 + "," + f2.
END.
ASSIGN count = count + 1.
END.

create temp-table tth.
update v_tablename.
create buffer tablbuf_hndl for table v_tablename.
qry_hndl:set-buffers(tablbuf_hndl).
qry_hndl:query-prepare("for each" + v_space + v_tablename).
qry_hndl:query-open().
tth:CREATE-LIKE(v_tablename).
tth:temp-table-prepare(v_tablename).
tablbuf_hndl2 = tth:DEFAULT-BUFFER-HANDLE .
count1 = 1.
assign i = 1 .

tablbuf_hndl2:BUFFER-CREATE.
tablbuf_hndl2:BUFFER-COPY(tablbuf_hndl).

END.

qry_hndl2:SET-BUFFERS(tablbuf_hndl2).
qry_hndl2:QUERY-PREPARE("for each" + v_space + v_tablename).
qry_hndl2:QUERY-OPEN().

i = 1 .
output to "/home/shafeem/target49.csv".






repeat:
qry_hndl2:get-next().
if qry_hndl2:query-off-end then leave.
DO i = 1 TO tablbuf_hndl2:NUM-FIELDS:
IF LOOKUP( tablbuf_hndl2:BUFFER-FIELD(i):NAME, m_line2 ) > 0 then
do:
IF i = 1 THEN DO:
m_line3 = tablbuf_hndl2:buffer-field(i):buffer-value().

END.
ELSE
DO:
m_line3 = m_line3 + ";" + tablbuf_hndl2:buffer-field(i):buffer-value().
END.
/* ASSIGN i = i + 1. */
end.
END.

/* IF LOOKUP( tablbuf_hndl2:BUFFER-FIELD(i):NAME, m_line2 ) > 0 then */
PUT UNFORMATTED
m_line3 skip.





can any one suggest me how to modify the codes so that fix values thing could be tackled. . is there any function that could replace the contents or something like that .
 
Back
Top