Skip to content

Instantly share code, notes, and snippets.

@byronferguson
Last active September 28, 2015 19:22
Show Gist options
  • Save byronferguson/ecf87d7b77c2a834a104 to your computer and use it in GitHub Desktop.
Save byronferguson/ecf87d7b77c2a834a104 to your computer and use it in GitHub Desktop.
Hiddens not being stripped \r\n
component extends="taffy.core.resource" taffy_uri="/students/{studentID:[0-9]+}/details" {
function get(required numeric studentID) {
try {
var proc = new storedProc();
//proc.setDatasource( "MyCCMajors" );
proc.setProcedure("generateReportDetailsByID");
proc.addParam(value=arguments.studentID, cfsqltype="cf_sql_integer");
proc.addProcResult(name="rs1", resultset="1");
var result = proc.execute();
}
catch(any e) {
return rep([e.message]).withStatus(500, "Query Failed");
}
var resultset = result.getProcResultSets().rs1;
if(resultset.recordCount) {
return rep(queryToArray(resultset)).withStatus(200, "OK");
}
else {
return noData().withStatus(204, "No Student Found");
}
}
}
[
{
"hsStatus": "Completed high school, diploma/GED\r\n",
"firstName": "Byron",
"collegeStatus": "",
"hsGradYear": "",
"birthdate": "",
"ethnicity": "White / Caucasian\r\n",
"hsSchoolID": "",
"collegeCredits": 32,
"asvabScore": "",
"collegeID": "",
"hsGradeLevel": "Graduate",
"gpaScale": 4,
"satScore": 1350,
"xfer": 1,
"lastName": "Ferguson",
"schoolLevel": "Not Attending",
"actScore": 31,
"gender": "Male",
"id": 459,
"otherStatus": "Some college credits earned, but not currently in college\r\n",
"currentGPA": 3
}
]
ALTER FUNCTION getSelectedOptionResponseByStudent
(
@qID int,
@studentID int
)
RETURNS nvarchar(MAX)
AS
BEGIN
-- Declare the return variable here
DECLARE @oText nvarchar(MAX);
SET @oText = (SELECT iqot.interviewQuestionOptionText AS oText
FROM srt
INNER JOIN iqot
ON (srt.interviewQuestionOptionID = iqot.interviewQuestionOptionID)
AND (srt.studentID = @studentID)
AND (iqot.interviewQuestionID = @qID));
RETURN REPLACE(REPLACE(@oText, '\r', ''), '\n', '');
END
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment