Hey, I am newbie to Qlik sense load script editor. I want a help on how to implement this piece of code in script editor.
How to declare the variables and use them in the select where condition.
thanks in advance.
code:
declare @startDate DATETIMEOFFSET = NULL,
@endDate DATETIMEOFFSET = NULL,
@agentId BIGINT = NULL,
DECLARE @transactionDateTimeFromLocal DATETIME = CONVERT(DATETIME, SWITCHOFFSET(@startDate, '+00:00')) DECLARE @transactionDateTimeToLocal DATETIME = CONVERT(DATETIME, SWITCHOFFSET(@endDate, '+00:00'))
IF OBJECT_ID('tempdb..#transactionReportDetails') IS NOT NULL
DROP TABLE #transactionReportDetails;
IF OBJECT_ID('tempdb..#transactionReportDetails2') IS NOT NULL
DROP TABLE #transactionReportDetails2;
IF @transactionDateTimeToLocal IS NOT NULL
SELECT @transactionDateTimeToLocal = DATEADD(d, 1, @transactionDateTimeToLocal);
SELECT *
INTO #transactionReportDetails
FROM
(SELECT
---------------------------------------
WHERE (@transactionDateTimeFromLocal IS NULL OR tt.transferDateTime >= @transactionDateTimeFromLocal) AND (@transactionDateTimeToLocal IS NULL OR tt.transferDateTime <= @transactionDateTimeToLocal)
AND (aaS.agentId = @agentId OR aD.agentId = @agentId)
AND (@networkOwnerId IS NULL OR td.networkOwnerAgentId = @networkOwnerId) ) AS tmp;