Hello,
I have an ajax call back that run as expected being called from a button, in the ajax call back i want it to display the result of rs.data(1) in a message box to the user that will then run another call back depending if the user selects YES. This callback works fine but I want to add a prompt showing the user what data it found before performing the next sql statement. Ive seen a lot of posts about using a5.messageBox.Show() but not sure how to use it. Here's what ive constructed so far:
I have an ajax call back that run as expected being called from a button, in the ajax call back i want it to display the result of rs.data(1) in a message box to the user that will then run another call back depending if the user selects YES. This callback works fine but I want to add a prompt showing the user what data it found before performing the next sql statement. Ive seen a lot of posts about using a5.messageBox.Show() but not sure how to use it. Here's what ive constructed so far:
Code:
function FindPreviousEvaluation as c ( e as p) 'Find Previous eval if it exists, and update current record debug(1) dim cn as sql::Connection dim args as sql::Arguments dim sqlUPDATE as c dim EvalCount as n dim rs as sql::resultset args.set("arg0", e.dataSubmitted.EVALUATION_YEAR) args.set("arg1", e.dataSubmitted.StaffID) flag = cn.open("::Name::StaffDB") If flag = .f. then FindPreviousEvaluation = "alert('Could Not Establish Connection');" else sql = <<%sql% SELECT MAX(EVALUATION_YEAR) AS PreviousEval FROM evaluations_mgrs WHERE STAFF_ID_FK = :arg1 AND EVALUATION_YEAR <> :arg0 %sql% cn.execute(sql, args) rs = cn.resultSet PreviousEvalYear = rs.data(1) args.set("arg2", PreviousEvalYear) cn.freeresult() If PreviousEvalYear = "" then 'Tell user no previous evaluation exists FindPreviousEvaluation = "alert('No Previous Evaluation Exists.');" else 'THIS IS WHERE I NEED HELP 'Display a prompt for the user asking how to proceed 'show message box as: "Last Eval year found: rs.data(1) that I previously placed in a variable -> {PreviousEvalYear}" 'Do you want to proceed? Yes button, Cancel button 'If "Yes button" = .t. then sqlUPDATE = <<%sql% UPDATE evaluations_mgrs t1 INNER JOIN evaluations_mgrs t2 ON (t1.STAFF_ID_FK=:arg1 AND t2.STAFF_ID_FK=:arg1) SET t1.PREVIOUS_OVERVIEW = t2.CURRENT_OVERVIEW, t1.PREVIOUS_GOALS = t2.CURRENT_GOALS, t1.PREVIOUS_FOCUS = t2.CURRENT_FOCUS, t1.PREVIOUS_STRENGTHS = t2.CURRENT_OVERVIEW, t1.PREVIOUS_AREAS_OF_IMPROVEMENTS = t2.CURRENT_AREAS_OF_IMPROVEMENT, t1.PREVIOUS_INCIDENTS = t2.CURRENT_INCIDENTS, t1.PREVIOUS_ACCOMPLISHMENTS = t2.CURRENT_ACCOMPLISHMENTS WHERE t1.EVALUATION_YEAR = :arg0 AND t2.EVALUATION_YEAR=:arg2 %sql% flag = cn.Execute(sqlUPDATE, args) 'else do nothing 'HOW DO I ACCOMPLISH THIS end if end if end if cn.Close() end function
Comment