Skip to content

Instantly share code, notes, and snippets.

@stphnwlkr
Created May 6, 2017 21:51
Show Gist options
  • Save stphnwlkr/c025467bba099567c8b401b4f48e84d8 to your computer and use it in GitHub Desktop.
Save stphnwlkr/c025467bba099567c8b401b4f48e84d8 to your computer and use it in GitHub Desktop.
remote any function getClosedICount() returnformat="plain" {
var cic = queryExecute("SELECT COUNT(*) as qty
FROM dbo.View_Request WITH (nolock)
Where left(ref_num,1) ='I' AND close_date IS NOT NULL",{},{});
return NumberFormat(cic.qty,',');
}
remote any function getAverageAgeClosedI() returnformat="plain" {
var ai = queryExecute("SELECT AVG(DATEDIFF(d, CONVERT(VARCHAR(12), DATEADD(s, open_date, '19700101'), 107),
CONVERT(VARCHAR(12), DATEADD(s, close_date, '19700101'), 107))) AS avgAge
FROM dbo.View_REQUEST
WHERE left(ref_num,1) ='I' AND close_date IS NOT NULL",{},{});
iavg = '#ai.avgAge# Days';
return iavg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment