This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*DATETIME FUNCTIONS | |
Functions to create datetime strings in a specific format. | |
Created to force dates to be passed as SQL parameters in the correct format (i.e. not MM/DD/YYYY) | |
*/ | |
function fDate(date) { | |
//Format date to 'dd/MM/yyyy' | |
if (typeof date == 'undefined') date = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ============================================= | |
-- Author: Rohan Shenoy | |
-- Create date: 2013-10-28 | |
-- Description: Function to return whether file exists | |
-- ============================================= | |
CREATE FUNCTION [dbo].[fnFileExists] (@path varchar(512)) RETURNS BIT | |
AS | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Gets all records in a SQL table and returns it as a single-dimension JSON object. | |
//If the parameter @VarName is passed, the returned output assignes the object to that variable. | |
CREATE PROCEDURE [dbo].[pGetJSONFromTable] @ObjectName VARCHAR(255), @VarName VARCHAR(255) = NULL, @registries_per_request smallint = null | |
AS | |
BEGIN | |
IF OBJECT_ID(@ObjectName) IS NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Gets the result of the query @ParameterSQL and returns it as a single-dimension JSON object | |
//If variable @VarName is passed, the resultant output assigns the object to that variable | |
CREATE PROCEDURE [dbo].[pGetJSONFromQuery] @ParameterSQL NVARCHAR(4000), @VarName VARCHAR(255) = NULL | |
AS | |
BEGIN | |
DECLARE @SQL NVARCHAR(1000) | |
DECLARE @XMLString VARCHAR(MAX) | |
DECLARE @XML XML; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'These routines will auto-close a workbook after a period of inactivity, useful for centrally-accessed | |
'non-shared workbooks that need to be accessed by multiple people. Also optional indicator to show who has | |
'opened the file, in case Excel only shows 'another user.' | |
'Put the following code in the 'ThisWorkbook' module: | |
'Timeout in seconds | |
Const Timeout As Integer = 300 | |
'Flag to enable auto-close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Module containing generic application routines. Any requisite functions/variables are now annotated | |
'in the routine header, allowing this module to be swapped out more easily | |
' | |
' (c) R Shenoy 30/07/2013 | |
' | |
' Last Updated 16/11/2018 | |
Option Explicit | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'This module was originally created by Rohan Shenoy in December 2012. It was designed to collect parameters, | |
'and use them to call stored procedures (in SQL Server 2005+). The primary function - sqlStoredProc takes the | |
'name of a stored procedure and a scripting dictionary containing a variable number of parameters (stored in | |
'key-value pairs). If the procedure returns a dataset, the function returns this data as an ADO recordset | |
'to the caller. | |
' | |
' - © R Shenoy 30/07/2013 | |
' | |
'(Remember to add references to ADO and Scripting Runtime libraries to any workbooks that you add this to) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//''------------------------- Update Functions | |
//Display current version number | |
function displayVersion() { | |
{dialog.object}.setValue('AppVersion', {dialog.object}.appVars.myVersion); | |
{dialog.object}.setValue('AppVersion1', {dialog.object}.appVars.myVersion); | |
//call this function recursively until version number has been set | |
if ($('version_help').innerHTML != {dialog.object}.appVars.myVersion) { | |
setTimeout(function() { displayVersion(); } , 500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//''------------------------- Authentication Functions | |
function authenticate(){ | |
var data = getLoginDetails(); | |
jQuery.ajax({ | |
type: "GET", | |
url: {dialog.object}.appVars.appURL + "ajax.a5w", | |
timeout: 30000, |
OlderNewer