Hi, i need to loop through a table, filter the records an perform actions on the filtered records.
This is all ok but at the same time i need to get the value of one of the fields in table that the loop is based. The field is 'ContactID'. I am unsure how to get this value for each record in the loop and then use it in subsequent actions.
This is all ok but at the same time i need to get the value of one of the fields in table that the loop is based. The field is 'ContactID'. I am unsure how to get this value for each record in the loop and then use it in subsequent actions.
Code:
'If case is interest only Dim cr_io as L cr_io = lookup("[PathAlias.ADB_Path]\progress.dbf","caseid = "+quote(session.caseid),"cr_intonly") if cr_io = .t. then dim tbl2 as P dim qry as P dim nrecs as N dim i as N tbl2 = table.open("[PathAlias.ADB_Path]\participants.dbf") filter_case = "caseid = " + quote(session.caseid) filter_type = "contacttype = 'Customer'" filter_recs ="("+filter_case +") .and. ("+filter_type +")" query.description = "Create IO Declarations to be signed by client" query.order = "" query.filter = filter_recs query.options = "" qry = tbl2.query_create() nrecs = qry.records_get() if nrecs=0 then end else tbl2.fetch_first() while .NOT. tbl2.fetch_eof() 'create note and document link dim tbl as p tbl = table.open("[PathAlias.ADB_Path]\activities.dbf") tbl.enter_begin() [COLOR="#FF0000"]tbl.contactid = Contactid from the table the loop is performed on[/COLOR] tbl.caseid = session.caseid tbl.created_by = session.employeename tbl.date_created=date() tbl.activity_type = "Note" tbl.activity_subject="Compliance" tbl.activity_body="Interest Only Declaration Generated and saved to file" tbl.published = "No" tbl.enter_end(.T.) tbl.enter_begin(.T.) tbl.caseid= session.caseid tbl.created_by = session.employeename tbl.document_name="Interest Only Declaration" tbl.document_path = vroot3 tbl.date_created = date() tbl.published = "Yes" tbl.document_extn = ".pdf" tbl.canesign = "true" tbl.enter_end(.T.) tbl.close() tbl2.fetch_next() end while qry.close() tbl2.close() end if
Comment