====== pears.NetCandidateSaveQuestions ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetCandidateSaveQuestions"( in "pWebUserID" char(20),in "qanswers" long varchar default null,in "pExperience" long varchar default null,in "pSourceID" char(20) default null,in "pPersonID" char(20) default null )
result( "pResult" char(250) )
// IQXWeb
begin
declare "qOriginID" char(20);
declare "CombinedNote" long varchar;
set "pPersonID" = "NetCandidateValidPersonID"("pWebUserID","pPersonID");
if "pPersonID" is null then
select '97:~Unique candidate link required';
return
end if;
if "isnull"("pSourceID",'') <> '' then
set "qOriginID" = "isnull"("pSourceID",(select top 1 "originid" from "origin" where "descrip" in( 'none','unknown' ) order by "sortorder" asc));
update "person" set "originid" = "qOriginID" where "personid" = "pPersonID"
end if;
if "isnull"("pExperience",'none') <> 'none' then
set "CombinedNote" = "string"('What is your experience: ',"pExperience","char"(13),"char"(13),(select top 1 "notes" from "person" where "personid" = "pPersonID"));
update "person" set "notes" = "CombinedNote" where "personid" = "pPersonID"
end if;
if "isnull"("qanswers",'none') <> 'none' then
call "IQXNetSaveQuestionnaire"("pPersonID","qanswers")
end if;
select '0:~Success'
end /* DOC
2017-11-07 GJ Created - Probably needs tweaking
2017-11-24 PC Needed tweaking :slightly_smiling_face:
2017-11-27 PC modified for Experience and Source fields
2018-02-02 PC spelling change
2018-07-19 GJ Changed to not change the sourceID when this procedure is called for the 2nd time
2018-10-22 MHS IW-456 multi-cand fix
2019-03-05 PC IW-873 add top 1 and order by on subqueries
Inputs:
pWebUserID
qanswers
Outputs:
pResult
*/
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetCandidateSaveQuestions" IS
{create PROCEDURE pears."NetCandidateSaveQuestions"( in pWebUserID char(20),in qanswers long varchar default null,in pExperience long varchar default null,in pSourceID char(20) default null, in pPersonID char(20) default null )
result( pResult char(250) )
// IQXWeb
BEGIN
declare qOriginID char(20);
declare CombinedNote long varchar;
set pPersonID=NetCandidateValidPersonID(pWebUserID,pPersonID);
if pPersonID is null then
select '97:~Unique candidate link required';
return;
end if;
if isnull(pSourceID,'') != '' then
set qOriginID = isnull(pSourceID,(select top 1 originid from origin where descrip in ('none','unknown') order by sortorder));
update person set originid=qOriginID where personid=pPersonID;
end if;
if isnull(pExperience,'none') != 'none' then
set CombinedNote = string('What is your experience: ',pExperience,char(13),char(13),(select top 1 notes from person where personid=pPersonID));
update person set notes=CombinedNote where personid=pPersonID;
end if;
if isnull(qanswers,'none') != 'none' then
call "IQXNetSaveQuestionnaire"(pPersonID,"qanswers");
end if;
select '0:~Success';
END
/* DOC
2017-11-07 GJ Created - Probably needs tweaking
2017-11-24 PC Needed tweaking :slightly_smiling_face:
2017-11-27 PC modified for Experience and Source fields
2018-02-02 PC spelling change
2018-07-19 GJ Changed to not change the sourceID when this procedure is called for the 2nd time
2018-10-22 MHS IW-456 multi-cand fix
2019-03-05 PC IW-873 add top 1 and order by on subqueries
Inputs:
pWebUserID
qanswers
Outputs:
pResult
*/
}