Hi All,
I have a repeating section that I need to loop through 1 row at a time, and then submit the data for each row.
With the help of http://wiki.alphasoftware.com/Parent...+in+Version+11, I wrote the following code.
I commented out the loop portions, to first get the sql insert to work. It does in fact submit the first row in the repeating section. As soon as I uncomment 'for i = 1 to ncount' and 'if len(e.dataSubmitted.WoChildId[i]) < 1 continue end if' data does not submit, and debug(1) does not fire.
Can someone look through my code, and let me know what I am missing?
Thanks,
James
I have a repeating section that I need to loop through 1 row at a time, and then submit the data for each row.
With the help of http://wiki.alphasoftware.com/Parent...+in+Version+11, I wrote the following code.
I commented out the loop portions, to first get the sql insert to work. It does in fact submit the first row in the repeating section. As soon as I uncomment 'for i = 1 to ncount' and 'if len(e.dataSubmitted.WoChildId[i]) < 1 continue end if' data does not submit, and debug(1) does not fire.
Can someone look through my code, and let me know what I am missing?
Code:
function afterDialogValidate as v (e as p) debug(1) dim sql as c DIM cn as SQL::Connection DIM args as sql::arguments DIM cr as sql::CallResult sql = "INSERT INTO WorkOrders (WoChildId, WoCustId, WoTechId, WoOpenDt, Approval, WoStatus, WoProjectId, WoDescription, WoSrtDtTm, WoEndDtTm, WoPropSrtDt, WoPropSrtTm, WoPropEndDt, WoPropEndTm, WoRespReq, WoTechPay, WoEmpId) VALUES (:WoChildId, :WoCustId, :WoTechId, :WoOpenDt1, :Approval1, :WoStatus1, :WoProject_Id1, :WoDescription1, :WoSrtDtTm1, :WoEndDtTm1, :WoPropSrtDt1, :WoPropSrtTm1, :WoPropEndDt1, :WoPropEndTm1, :WoRespReq1, :WoTechPay1, :WoEmpId1)" cn.PortableSQLEnabled = .t. cn.open("::Name::ProSQL") dim i as n dim ncount as n = e.dataSubmitted.WoChildId.size() for i = 1 to ncount 'Test to see if the row in the repeating section has data. ' If not, skip to the next row. if len(e.dataSubmitted.WoChildId[i]) < 1 continue end if args.Clear() args.set("WoTechId", e.dataSubmitted.WoTechId[i]) args.set("WoChildId", e.dataSubmitted.WoChildId[i]) args.set("WoCustId", e.dataSubmitted.WoCustId1[i]) args.set("WoOpenDt1", convert_type(e.dataSubmitted.WoOpenDt1[i], "D")) args.set("Approval1", e.dataSubmitted.Approval1[i]) args.set("WoStatus1", e.dataSubmitted.WoStatus1[i]) args.set("WoProject_Id1", e.dataSubmitted.WoProject_Id1[i]) args.set("WoDescription1",e.dataSubmitted.WoDescription1[i]) args.set("WoSrtDtTm1",convert_type(e.dataSubmitted.WoSrtDtTm1[i], "T")) args.set("WoEndDtTm1",convert_type(e.dataSubmitted.WoEndDtTm1[i], "T")) args.set("WoPropSrtDt1",convert_type(e.dataSubmitted.WoPropSrtDt1[i], "D")) args.set("WoPropSrtTm1",CTOT(e.dataSubmitted.WoPropSrtTm1[i])) args.set("WoPropEndDt1",convert_type(e.dataSubmitted.WoPropEndDt1[i], "D")) args.set("WoPropEndTm1",CTOT(e.dataSubmitted.WoPropEndTm1[i])) args.set("WoRespReq1",convert_type(e.dataSubmitted.WoRespReq1[i], "T" )) args.set("WoTechPay1",e.dataSubmitted.WoTechPay1[i]) args.set("WoEmpId1",e.dataSubmitted.WoEmpId1[i]) cn.Execute(sql,args) cr = cn.CallResult e.javascript = cr.text; cn.Close() next i end function
Thanks,
James
Comment