Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: beckyjmcd on February 20, 2015, 11:50:45 PM

Title: Is strategy information stored in a database?
Post by: beckyjmcd on February 20, 2015, 11:50:45 PM
I have the task of documenting our current strategies so that those without access to Genesys applications know what strategies are loaded where and can get a general description of the strategy.

Is basic information about each strategy stored in a database that I can query?  I would like to query for all loaded strategies and have it return the route points the strategy is loaded on.

I know I can kind of get this from Info Mart by looking at the Interaction Resource Fact table joined with the Resource table and Strategy table but it does not show me all route points that the strategy is loaded on but rather only interactions that have used the strategy from the last route point.

Title: Re: Is strategy information stored in a database?
Post by: cavagnaro on February 21, 2015, 01:29:33 AM
If you see CME under each RP on annex tab you have the strategy loaded on it, therefore there must be a query to get that information.
Which query, no clue, you will have to dig on it.
Title: Re: Is strategy information stored in a database?
Post by: Adam G on February 21, 2015, 11:40:56 AM
[quote author=beckyjmcd link=topic=8724.msg38723#msg38723 date=1424476245]
I have the task of documenting our current strategies so that those without access to Genesys applications know what strategies are loaded where and can get a general description of the strategy.

Is basic information about each strategy stored in a database that I can query?  I would like to query for all loaded strategies and have it return the route points the strategy is loaded on.

I know I can kind of get this from Info Mart by looking at the Interaction Resource Fact table joined with the Resource table and Strategy table but it does not show me all route points that the strategy is loaded on but rather only interactions that have used the strategy from the last route point.
[/quote]

I'm looking into this, now.....

Check back later!
Title: Re: Is strategy information stored in a database?
Post by: Adam G on February 21, 2015, 05:40:49 PM
[quote author=adamgill link=topic=8724.msg38725#msg38725 date=1424518856]
[quote author=beckyjmcd link=topic=8724.msg38723#msg38723 date=1424476245]
I have the task of documenting our current strategies so that those without access to Genesys applications know what strategies are loaded where and can get a general description of the strategy.

Is basic information about each strategy stored in a database that I can query?  I would like to query for all loaded strategies and have it return the route points the strategy is loaded on.

I know I can kind of get this from Info Mart by looking at the Interaction Resource Fact table joined with the Resource table and Strategy table but it does not show me all route points that the strategy is loaded on but rather only interactions that have used the strategy from the last route point.
[/quote]

I'm looking into this, now.....

Check back later!
[/quote]

I've done a thorough check and - no - there isn't  a way to connect Tables to show the name or a strategy and on which RP it is loaded, through the cfg database.

The nearest I have found are in[b] cfg_script [/b]and [b]cfg_flex_prop [/b]- both mention Strategy Names but neither shows if/where the Strategy is loaded.

I took the view that, if there is a tab on the RP in CME, then you must be able to query it.  It doesn't look like that is possible.  So, my best guess is that the Tab in CME is either extracted from a "through" component in cfg, which queries the URS.

I might keep digging but don't hold your breath!
Title: Re: Is strategy information stored in a database?
Post by: genesysguru on February 22, 2015, 08:48:21 AM
Hi,

I read my own blog so know it must be possible!

http://genesysguru.com/blog/blog/2011/03/25/genesys-strategy-analyser/

A snippet of the code is below. e.g. using the PSDK to read RP options from CME. Should be possible to get the same from raw cfg tables.

Regards

>>>

        public int getRoutingPointsForStrategy(String strategyName)
        {
            int loadedCount = 0;
            try
            {
                if (routingPoints == null)
                {
                    return loadedCount;
                }

                foreach (CfgDN routingPoint in routingPoints)
                {
                    String routingServerName = "";
                    String optionName = "";
                    String optionValue = "";
                    String strategyInfo = "";

                    for (int i = 0; i < routingPoint.UserProperties.AllKeys.Length; i++)
                    {
                        Boolean strategyFound = false;
                        strategyInfo = "";

                        // Section
                        routingServerName = routingPoint.UserProperties.AllKeys[i];

                        Genesyslab.Platform.Commons.Collections.KeyValueCollection section
                        = (Genesyslab.Platform.Commons.Collections.KeyValueCollection)routingPoint.UserProperties.AllValues[i];

                        for (int j = 0; j < section.AllKeys.Length; j++)
                        {
                            optionName = section.AllKeys[j].ToString();
                            optionValue = section.AllValues[j].ToString();

                            switch (optionName)
                            {
                                case "strategy":
                                case "strategy0x65":
                                    if (strategyName.ToLower().Contains(optionValue.ToLower()) == true)
                                    {
                                        strategyFound = true;
                                    }
                                    break;

                                case "Loaded":
                                    strategyInfo += "Loaded " + optionValue + " ";
                                    break;

                                case "Loaded by":
                                    strategyInfo += "by " + optionValue + " ";
                                    break;
                                default:
                                    break;
                            }

                        }

                        if (strategyFound == true)
                        {
                            strategyInfo += "\n";
                            strategyInfo += "Router: " + routingServerName + " ";
                            strategyInfo += "Switch: " + routingPoint.Switch.Name + " ";
                            strategyInfo += "Routing Point: " + routingPoint.Name + " ";
                            strategyInfo += "[" + routingPoint.Number + "] ";

                            log.LogMessage(Logger.LogTypeEnum.INFO, strategyInfo);
                            updateStatusText(strategyInfo, Color.Black, false);

                            loadedCount = loadedCount + 1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (log != null)
                {
                    log.LogMessage(Logger.LogTypeEnum.ERROR, "Exception: " + ex.Message);
                }
            }
            return loadedCount;
        }
Title: Re: Is strategy information stored in a database?
Post by: Adam G on February 22, 2015, 10:30:45 AM
Aha! :)

OK - I will look into this...

decoding on a Sunday.... what am I doing??? lol
Title: Re: Is strategy information stored in a database?
Post by: Adam G on February 22, 2015, 11:13:56 AM
Not very elegant - but then I'm not actually developing it;

[b][color=blue]SELECT DISTINCT cfg_dn.number_ AS [Route Point], cfg_flex_prop.prop_name AS [Strategy/Action], cfg_flex_prop.prop_value AS Details
FROM            cfg_flex_prop INNER JOIN
                        cfg_dn ON cfg_flex_prop.object_dbid = cfg_dn.dbid
WHERE        (cfg_flex_prop.prop_name = 'strategy0x65') OR
                        (cfg_flex_prop.prop_name = 'Loaded') OR
                        (cfg_flex_prop.prop_name = 'Loaded by')
ORDER BY [Route Point], [Strategy/Action] DESC[/color][/b]

I will need someone to confirm this for me... and to help to create a decent script for everyone else!

Ta
Title: Re: Is strategy information stored in a database?
Post by: Adam G on February 23, 2015, 10:48:52 AM
[url=http://www.thebigbookseries.com/Strategies.bqy]Another basic solution, if you have a Hyperion Client[/url]

It is a basic Report by Strategy/Route Point and also by Route Point/Strategy. You can break it open and use the Queries, if you need to amend anything.

But nowhere near as elegant as a PSDK solution!
Title: Re: Is strategy information stored in a database?
Post by: cavagnaro on February 25, 2015, 05:40:02 PM
Adam your query returned me a lot of duplicated records on a MCR mixed environment:

Here is my query:

[code]
select
dn.number_,
f1.prop_name, f1.prop_value, f2.prop_name, f2.prop_value
from cfg_flex_prop f1
inner join cfg_flex_prop f2
on f1.object_dbid = f2.object_dbid
inner join cfg_dn dn
on dn.dbid = f1.object_dbid
where 
lower(f1.prop_name) = 'strategy'
and lower(f2.prop_name) = 'loaded'
and dn.type = 4
and f1.object_type = 2
order by 1
[/code]

Pls validate too ;)
Title: Re: Is strategy information stored in a database?
Post by: Adam G on February 25, 2015, 06:44:51 PM
Yes - this works too...  only one change - DISTINCT:

[color=blue]select [b]distinct [/b]dn.number_, f1.prop_name, f1.prop_value, f2.prop_name, f2.prop_value
from cfg_flex_prop f1
inner join cfg_flex_prop f2
on f1.object_dbid = f2.object_dbid
inner join cfg_dn dn
on dn.dbid = f1.object_dbid
where  lower(f1.prop_name) = 'strategy' and lower(f2.prop_name) = 'loaded' and dn.type = 4 and f1.object_type = 2
order by 1[/color]

I also see multiple entries against the Strategy loaded date/time - a version of row number / partition would address that.

....and I wonder if the OP is still alive? lol