Re: Moving from DBF to SQL
Good evening Gandhi .....
Have got it to work at last! Here is the code I used:
It does all it should do: save a new customer; save the 13 job types in the interest table for the new customer and the new security user in the websecurityusers table.
It was down to having an underscore in the wrong place! It was the debug that helped to find the error!
Thanks for all your help .... much appreciated.
Good evening Gandhi .....
Have got it to work at last! Here is the code I used:
Code:
function afterDialogValidate as v (e as p) 'debug(1) dim rtc.flagRecordWasSaved as l 'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'. ExecuteServerSideAction("Save Data::SaveUser") if rtc.flagRecordWasSaved then dim customer_id as n customer_id = rtc.a_sections[1].rows[1].alias[1].primaryKeyValue[1].value dim customer_type as c customer_type = e.dataSubmitted.Cust_Type if customer_type = "job seeker" .or. customer_type = "both" then dim cn as sql::Connection dim result as l = .f. ' dim arguments as sql::Arguments dim sqlInsert as c result = cn.Open("::Name::Remote_Live") if result then sqlInsert = "INSERT INTO interest (customer_id, job_type_id, job_type_desc) SELECT " sqlInsert = sqlInsert + customer_id + ", job_type_id, job_type_desc FROM job_type" result = cn.execute(sqlInsert) if result then dim msg as c msg = "alert('success');" else msg = "alert('failure');" end if cn.close() end if end if end if e.javascript = e.javascript + crlf() + msg 'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'. ExecuteServerSideAction("Save Web Security Values::SaveSecurity") end function
It was down to having an underscore in the wrong place! It was the debug that helped to find the error!
Thanks for all your help .... much appreciated.
Comment