cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1315
Views
25
Helpful
2
Replies

Target Requery report

J_Cormier
Level 1
Level 1

Hi,

 

We have multiple precision queue and I want to validate if 'Enable target requery' is enable or not.

 

I dont think this data is stored in the UCCE database. Do you know a way I can get a report with this information ? 

 

 

2 Replies 2

Hi,

Your correct, there is no specific reports we can find using Find Notes ( Control+F) and select node type as IF and find all the active scripts.

 

Ram.S

Regards,
Ram.S

Omar Deen
Spotlight
Spotlight

So yes, there is a way but it is a really unorthodox approach. Full credit for this idea goes to Gary Fearn (https://ciscocontactcentersecrets.wordpress.com/)

 

Run this query

 

DECLARE @Search AS Varchar(32)
SET @Search = 'ScriptPrecisionQueue' -- The string you want TO SEARCH for.
DECLARE @ChunkSize int
SET @ChunkSize = 8000 DECLARE @pos Int DECLARE @tmpstrlen Int DECLARE @strlen Int DECLARE @chunk varchar(MAX) DECLARE @scriptid int DECLARE @scriptname varchar(32) DECLARE @version int DECLARE @teststr Varchar(1) 
--DELETE TABLES IF IN USE
IF(OBJECT_ID('tempdb..#Nodes') IS NOT NULL) BEGIN
DROP TABLE #Nodes END
IF(OBJECT_ID('tempdb..#Scr') IS NOT NULL) BEGIN
DROP TABLE #Scr END
CREATE TABLE #Scr (ScriptID Int, Flag Int)
CREATE TABLE #Nodes (ScriptID Int, ScriptName Varchar(32),
VERSION int, Pos Int, MyStr VarChar(MAX), StrLen Int)
INSERT INTO #Scr
SELECT s.ScriptID, 0
FROM Script s
JOIN Master_Script ms ON (ms.MasterScriptID = s.MasterScriptID)
WHERE (s.Version = ms.CurrentVersion
       OR (ms.CurrentVersion=-1
           AND ms.NextAvailableVersion=s.Version+1)) -- restricts TO CURRENT VERSION only.
  SELECT @scriptid =
    (SELECT top 1 ScriptID
     FROM #Scr
     WHERE Flag = 0) WHILE EXISTS
    (SELECT top 1 ScriptID
     FROM #Scr
     WHERE Flag = 0) BEGIN
  SELECT @chunk = Convert(VARCHAR(MAX), SUBSTRING(sd.ScriptData, 0, @ChunkSize)),
         @pos = CHARINDEX(@Search, Convert(VARCHAR(MAX), SUBSTRING(sd.ScriptData, 0, @ChunkSize))),
         @strlen = LEN(SUBSTRING(Convert(VARCHAR(MAX), SUBSTRING(sd.ScriptData, 0, @ChunkSize)), @pos, CHARINDEX('}'+CHAR(10), Convert(VARCHAR(MAX), SUBSTRING(sd.ScriptData, 0, @ChunkSize)), @pos) - @pos +1)),
         @scriptname = ms.EnterpriseName,
         @scriptid = s.ScriptID,
         @version = s.Version
  FROM Script_Data sd
  JOIN Script s ON (s.ScriptID = sd.ScriptID)
  JOIN Master_Script ms ON (ms.MasterScriptID = s.MasterScriptID)
  WHERE s.ScriptID = @scriptid WHILE @pos>0
    AND @pos < @ChunkSize BEGIN
    INSERT INTO #Nodes
    SELECT @scriptid,
           @scriptname,
           @version,
           @pos,
           Mystr = SUBSTRING(@chunk, @pos, CHARINDEX('}'+CHAR(10), @chunk, @pos) - @pos +1),
           @strlen
    SELECT @teststr = SUBSTRING(@chunk, @pos+@strlen+1, 1) WHILE @teststr = '*' BEGIN
    SELECT @tmpstrlen = @pos+@strlen+1
    INSERT INTO #Nodes
    SELECT @scriptid,
           @scriptname,
           @version,
           @tmpstrlen,
           REPLACE(SUBSTRING(@chunk, @pos+@strlen+1, CHARINDEX('}'+CHAR(10), @chunk, @pos+@strlen+1)-(@pos+@strlen)),'* {', @Search+' {') AS MyStr,
           Len(REPLACE(SUBSTRING(@chunk, @pos+@strlen+1, CHARINDEX('}'+CHAR(10), @chunk, @pos+@strlen+1)-(@pos+@strlen)),'* {', @Search+' {'))
    SET @strlen = Len(SUBSTRING(@chunk, @pos+@strlen+1, CHARINDEX('}'+CHAR(10), @chunk, @pos+@strlen+1)-(@pos+@strlen)))
    SET @pos = @tmpstrlen
    SELECT @teststr = SUBSTRING(@chunk, @pos+@strlen+1, 1) END
    SELECT @pos = CHARINDEX(@Search, @chunk, @pos+1),
           @strlen = LEN(SUBSTRING(@chunk, @pos, CHARINDEX('}'+CHAR(10), @chunk, @pos) - @pos +1)) END
    UPDATE #Scr
    SET Flag = 1 WHERE #Scr.ScriptID = @scriptid
    SELECT @scriptid =
      (SELECT top 1 ScriptID
       FROM #Scr
       WHERE Flag = 0) END
  SELECT *
  FROM #Nodes

You'll get back some information where some of it looks familiar and others looks kind of cryptic. Here's an example of what you may find under the MyStr column for the PQ node in its respective script:

 

ScriptPrecisionQueue {156 8 1 754 739 1 -1 "Call.PeripheralVariable2" 5 1 0 2 23 0}

ScriptPrecisionQueue {156 8 1 754 739 1 -1 "Call.PeripheralVariable2" 5 0 0 2 23 0}

 

These are the parameters of the PQ Node itself. I won't go into details about each parameter, but the tenth parameter is the one that tells you if the PQ node has Enable target requery checked. If it's a 1, it's checked... if it's a 0, it's not checked. If you have more than one PQ node in a script and you want to know which is which, the thirteenth parameter tells you the Node ID. So in the example above, 23 is the Node ID for that PQ node.

If you have a lot of results, you can probably export it to a CSV and do some Excel magic to parse the data for easier reading.