When a user adds a record to a table (Products) we need to create records in another related table.
I think i have the script to do this for a single entry but wondered if i just need to duplicate this for every record we need to add to the table or is there a way i can add multiple records to the same table at the same time in a more efficient way? The only field value which changes for each record is Doc_Name
I think i have the script to do this for a single entry but wondered if i just need to duplicate this for every record we need to add to the table or is there a way i can add multiple records to the same table at the same time in a more efficient way? The only field value which changes for each record is Doc_Name
Code:
'create records for documents which are required for this mortgage. Need KFI, App, Research and RoS dim session.prodid as c session.prodid = e.rtc.lastPrimaryKeyValue ' DIM standard variables ' ----------------------- dim cn as sql::Connection dim rs as sql::ResultSet dim args as sql::Arguments ' Here's the Query: ' -------------------- sql= <<%a% INSERT INTO Activities (CaseID, ProdID, Provider, Doc_Path, Created, Created_By, Activity_Type, Doc_Name, Doc_Extn) values (:caseref, :ProdID, :Provider, :Doc_path, :Created, :Created_By, :Activity_Type, :Doc_Name, :Doc_Extn) %a% ' set argument value. args.set("CaseID", val(session.CaseID)) args.set("ProdID", val(session.prodid)) args.set("Provider", Provider) args.set("Doc_Path", Doc_Path) args.set("Created", Date()) args.set("Created_By", session.contactname) args.set("Activity_Type", "Document") args.set("Doc_Name", "Key Facts Illustration") args.set("Doc_Extn", ".pdf") cn.open("::name::MM3") cn.execute(sql, args)' Execute the query - don't forget the args: cn.close()
Comment