I don't know what I am doing wrong here but I am getting an error of "extra characters at end of expression"
This is the line that errs:
vn = eval("thf."+tmp.fldname)
tmp = table.open_session("t_repfin")
thf = table.open_session("hh_fin")
hh_fin is a one record table that has 50 fields with amounts I am trying to map to t_repfin->fldname that has 50 records. So I query hh_fin to set it to the one record I need, then fetch thru t_repfin and set each t_repfin record to the matching field in hh_fin.
here's the section of the script I am working with (Note TLN() is a udf that writes to the trace window)
This is the line that errs:
vn = eval("thf."+tmp.fldname)
tmp = table.open_session("t_repfin")
thf = table.open_session("hh_fin")
hh_fin is a one record table that has 50 fields with amounts I am trying to map to t_repfin->fldname that has 50 records. So I query hh_fin to set it to the one record I need, then fetch thru t_repfin and set each t_repfin record to the matching field in hh_fin.
here's the section of the script I am working with (Note TLN() is a udf that writes to the trace window)
Code:
if xflag then tmp.batch_begin() tmp.fetch_first() WHILE .not. tmp.fetch_eof() 'map each of the hh_fin fields in the one record to create a matching record in t_repfin 'errs with 'extra chars at end of expression' [COLOR=#ff0000] vn = eval("thf."+tmp.fldname)[/COLOR] 'returned fieldname instead of amount 'vn = thf.eval(quote(tmp.fldname)) Tln("hh_fin->"+tmp.fldname,vn) commit_flag = .t. select case blankflag = .t. on error goto ERRMSG3 tmp.change_begin() 'select all records to display as blank in report tmp.sel_flag = .t. tmp.change_end(commit_flag) goto SKIPIT case tmp.FLDNAME = "" goto SKIPIT [COLOR=#0000ff]case eval("thf."+tmp.fldname) > 0[/COLOR] 'case thf.eval(quote(tmp.fldname)) > 0 on error goto ERRMSG3 tmp.change_begin() [COLOR="#0000FF"]'tmp.amount = eval("thf."+tmp.fldname) tmp.amount = thf.eval(quote(tmp.fldname))[/COLOR] tmp.sel_flag = .t. tmp.change_end(commit_flag) end select SKIPIT: on error goto 0 'should stop loop on error if commit_flag then tmp.fetch_next() else EXIT WHILE end if END WHILE tmp.batch_end() CLOSETBLS: lst1 = crlf_to_comma(tmp.Enum_Session_Open()) Tln("tmp open list",lst1) if inlist2(tmp.name_get(),lst1) then tmp.close() end if lst2 = crlf_to_comma(thf.Enum_Session_Open()) Tln("thf open list",lst2) if inlist2(thf.name_get(),lst2) then thf.close() end if end if if commit_flag then ui_beep(UI_STANDARD_BEEP) end if
Comment