<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://all.docs.genesys.com/index.php?action=history&amp;feed=atom&amp;title=Module%3APEArchitecture</id>
	<title>Module:PEArchitecture - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://all.docs.genesys.com/index.php?action=history&amp;feed=atom&amp;title=Module%3APEArchitecture"/>
	<link rel="alternate" type="text/html" href="https://all.docs.genesys.com/index.php?title=Module:PEArchitecture&amp;action=history"/>
	<updated>2026-05-16T04:06:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://all.docs.genesys.com/index.php?title=Module:PEArchitecture&amp;diff=117359&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot;local p = {} -- p stands for package local cargo = mw.ext.cargo  -- merge function copied from Frame description: https://river.me/blog/frame-wtf/#frameexpandtemplate local fu...&quot;</title>
		<link rel="alternate" type="text/html" href="https://all.docs.genesys.com/index.php?title=Module:PEArchitecture&amp;diff=117359&amp;oldid=prev"/>
		<updated>2022-03-30T15:33:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {} -- p stands for package local cargo = mw.ext.cargo  -- merge function copied from Frame description: https://river.me/blog/frame-wtf/#frameexpandtemplate local fu...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {} -- p stands for package&lt;br /&gt;
local cargo = mw.ext.cargo&lt;br /&gt;
&lt;br /&gt;
-- merge function copied from Frame description: https://river.me/blog/frame-wtf/#frameexpandtemplate&lt;br /&gt;
local function merge()&lt;br /&gt;
    local f = mw.getCurrentFrame()&lt;br /&gt;
    local origArgs = f.args&lt;br /&gt;
    local parentArgs = f:getParent().args&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs(origArgs) do&lt;br /&gt;
        v = mw.text.trim(tostring(v))&lt;br /&gt;
        if v ~= '' then&lt;br /&gt;
            args[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    for k, v in pairs(parentArgs) do&lt;br /&gt;
        v = mw.text.trim(v)&lt;br /&gt;
        if v ~= '' then&lt;br /&gt;
            args[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return args&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function overwrite(f)&lt;br /&gt;
    local origArgs = f.args&lt;br /&gt;
    local parentArgs = f:getParent().args&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs(parentArgs) do&lt;br /&gt;
        v = mw.text.trim(v)&lt;br /&gt;
        args[k] = v&lt;br /&gt;
    end&lt;br /&gt;
    for k, v in pairs(origArgs) do&lt;br /&gt;
        v = mw.text.trim(tostring(v))&lt;br /&gt;
        args[k] = v&lt;br /&gt;
    end&lt;br /&gt;
    return args&lt;br /&gt;
end&lt;br /&gt;
-- finish copied code from https://river.me/blog/frame-wtf/#frameexpandtemplate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- helpful function to see table contents. Source: https://stackoverflow.com/a/27028488&lt;br /&gt;
local function dump(o)&lt;br /&gt;
   if type(o) == 'table' then&lt;br /&gt;
      local s = '{ '&lt;br /&gt;
      for k,v in pairs(o) do&lt;br /&gt;
         if type(k) ~= 'number' then k = '&amp;quot;'..k..'&amp;quot;' end&lt;br /&gt;
         s = s .. '['..k..'] = ' .. dump(v) .. ','&lt;br /&gt;
      end&lt;br /&gt;
      return s .. '} '&lt;br /&gt;
   else&lt;br /&gt;
      return tostring(o)&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- helpful function to split strings. Source: https://stackoverflow.com/questions/1426954&lt;br /&gt;
local function split(pString, pPattern)&lt;br /&gt;
   local Table = {} &lt;br /&gt;
   local fpat = &amp;quot;(.-)&amp;quot; .. pPattern&lt;br /&gt;
   local last_end = 1&lt;br /&gt;
   local s, e, cap = pString:find(fpat, 1)&lt;br /&gt;
   while s do&lt;br /&gt;
      if s ~= 1 or cap ~= &amp;quot;&amp;quot; then&lt;br /&gt;
     table.insert(Table,cap)&lt;br /&gt;
      end&lt;br /&gt;
      last_end = e+1&lt;br /&gt;
      s, e, cap = pString:find(fpat, last_end)&lt;br /&gt;
   end&lt;br /&gt;
   if last_end &amp;lt;= #pString then&lt;br /&gt;
      cap = pString:sub(last_end)&lt;br /&gt;
      table.insert(Table, cap)&lt;br /&gt;
   end&lt;br /&gt;
   return Table&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getWikiContent ()&lt;br /&gt;
    local mwtitle = mw.title.getCurrentTitle()&lt;br /&gt;
    return mwtitle:getContent()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getTemplateArgs (TemplateName, ArgName)&lt;br /&gt;
    -- get MW page content&lt;br /&gt;
    local mwcontent = getWikiContent()&lt;br /&gt;
    -- get content from inside template&lt;br /&gt;
    -- note that this current won't work if there are multiple instance of the template, returning only the first value in that case...&lt;br /&gt;
    i, j = string.find(mwcontent, TemplateName)&lt;br /&gt;
    if i == nil then&lt;br /&gt;
        -- can't find the template; return nil&lt;br /&gt;
        return &amp;quot;err: can't find template for: &amp;quot; .. TemplateName&lt;br /&gt;
    else&lt;br /&gt;
        -- remove any wikitext content outside the template&lt;br /&gt;
        local templatecontent = string.match(mwcontent, '%b{}', i-2)&lt;br /&gt;
        templatecontent = string.sub(templatecontent, 3, -3)&lt;br /&gt;
        if templatecontent == nil then&lt;br /&gt;
            -- this shouldn't really happen?&lt;br /&gt;
            return &amp;quot;err: no template content found&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            if ArgName == nil then&lt;br /&gt;
                -- if no ArgName specified, I guess return a table with all arguments?&lt;br /&gt;
                return split(templatecontent, '\|')&lt;br /&gt;
            else&lt;br /&gt;
                -- try to pull out just the matching value for ArgName&lt;br /&gt;
                return string.match(templatecontent, &amp;quot;\|&amp;quot; .. ArgName .. &amp;quot;=([^\|]+)|&amp;quot;)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.findNumberOfSections (frame)&lt;br /&gt;
-- ED: TESTING MY CODE HERE&lt;br /&gt;
    local args = getTemplateArgs('ArticlePEServiceArchitecture2', 'NumberOfSections')&lt;br /&gt;
    return dump(args)&lt;br /&gt;
-- Barry's code&lt;br /&gt;
    -- local args = overwrite(frame)&lt;br /&gt;
    -- return 'number of sections: ' .. dump(args) --.NumberOfSections&lt;br /&gt;
-- Old tests&lt;br /&gt;
    --local x = frame:expandTemplate{ title = 'ArticlePEServiceArchitecture2', args = NumberOfSections= }&lt;br /&gt;
    --for k, v in pairs (x) do &lt;br /&gt;
    --return k,v &lt;br /&gt;
    --end&lt;br /&gt;
end&lt;br /&gt;
    --local x = mw.getCurrentFrame():getParent().args&lt;br /&gt;
   -- return &amp;quot;test: &amp;quot; .. x&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--function p.printSection ()&lt;br /&gt;
 --  local a = findNumberOfSections&lt;br /&gt;
 --      out = ''&lt;br /&gt;
--    for i = 1, a do&lt;br /&gt;
--        out = out .. &amp;quot;Test&amp;quot; .. i&lt;br /&gt;
--    end&lt;br /&gt;
--    return out&lt;br /&gt;
--end&lt;br /&gt;
&lt;br /&gt;
-- find images&lt;br /&gt;
function p.findImages () &lt;br /&gt;
       tables = 'ArticlePEServiceArchitecture,ArticlePEServiceArchitecture__Images'&lt;br /&gt;
       fields = 'ArticlePEServiceArchitecture__Images._value=Image'&lt;br /&gt;
       local args = {&lt;br /&gt;
           join = 'ArticlePEServiceArchitecture._ID=ArticlePEServiceArchitecture__Images._rowID',&lt;br /&gt;
           where = 'ArticlePEServiceArchitecture._pageName = &amp;quot;' .. mw.title.getCurrentTitle().prefixedText .. '&amp;quot;',&lt;br /&gt;
        }&lt;br /&gt;
       local result = cargo.query( tables, fields, args )&lt;br /&gt;
       local text = ''&lt;br /&gt;
     for i, row in ipairs(result) do&lt;br /&gt;
             text =  text .. &amp;quot;[[File:&amp;quot; .. row.Image .. &amp;quot;]]&amp;quot;&lt;br /&gt;
         end&lt;br /&gt;
         return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--find how many connections for an architecture image&lt;br /&gt;
function p.findConnections () &lt;br /&gt;
       tables = 'PEArchitectureSection'&lt;br /&gt;
       fields = 'NumberOfConnections'&lt;br /&gt;
       local args = {&lt;br /&gt;
        where = 'PEArchitectureSection._pageName = &amp;quot;' .. mw.title.getCurrentTitle().prefixedText .. '&amp;quot;',&lt;br /&gt;
        }&lt;br /&gt;
       local result = cargo.query( tables, fields, args )&lt;br /&gt;
     for i, row in ipairs(result) do&lt;br /&gt;
             text =  row.NumberOfConnections&lt;br /&gt;
         end&lt;br /&gt;
        return text&lt;br /&gt;
end&lt;br /&gt;
--query to build a table based on NumberOfConnections in PEArchitectureSection&lt;br /&gt;
function p.printConnections (frame,args) &lt;br /&gt;
local a = frame.args[1]&lt;br /&gt;
    local out = &amp;quot;&amp;lt;h2&amp;gt;Connection table&amp;lt;/h2&amp;gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Connection&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Included Service&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Protocol&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Port&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Connected to&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Data type&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;&lt;br /&gt;
        local x =&amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;br /&gt;
    for i = 0, a, 1  do&lt;br /&gt;
        out = out .. &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot; .. i + 1 .. &amp;quot;&amp;lt;/td&amp;gt;&amp;quot; .. &amp;quot;&amp;lt;td&amp;gt;{{{field|&amp;quot; .. i .. &amp;quot;Service}}}&amp;lt;/td&amp;gt;&amp;quot; .. &amp;quot;&amp;lt;td&amp;gt;{{{field|&amp;quot; .. i .. &amp;quot;Protocol}}}&amp;lt;/td&amp;gt;&amp;quot;.. &amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    return out,x&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
		
	</entry>
</feed>