Tuesday, October 16, 2012

Interact Intranet: Administrative Queries


We are getting close to our go-live date with Interact Intranet and it is time for us to do final cleanup to ensure our site is as consistent as possible.  To supplement the out of the box metrics I created a post of document queries, and this post of queries is going to focus on content structure and organization.

Absolute vs Relative Links

If you have a tendency to link to content (documents, teams, areas, categories, etc) within your intranet you might find that some of your links are absolute and others are relative.  This becomes an issue if you use different URLs for intranet, extranet or outside users. Use this query to verify that all of your links are relative:
SELECT SECTION.Title, SECTION2.Title as Parent, SMI.URL from SECTION_PROPERTIES_SIDEMENUITEM as SMI
INNER JOIN SECTION
on SECTION.SectionID=SMI.SectionID
INNER JOIN SECTION as SECTION2
on SECTION.ParentID=SECTION2.SectionID
WHERE SMI.URL like 'http://%'

Links Specify Page Format

If you create links within your intranet to other areas you might find that some of your links were created using a URL which specifies formatting.  All links which aim at Section/Main should use the default.aspx as opposed to using a defined .aspx page such as MainTwoColumnsLeft MainOneColumnLeft, etc.  You can verify that your site is clean by using this query:
SELECT SECTION.Title, SECTION2.Title as Parent, SMI.URL  FROM SECTION_PROPERTIES_SIDEMENUITEM as SMI
INNER JOIN SECTION
on SECTION.SectionID=SMI.SectionID
INNER JOIN SECTION as SECTION2
on SECTION.ParentID=SECTION2.SectionID
WHERE SMI.URL like '/Interact/Pages/Section/Main%'
ORDER BY Parent

Inconsistent Links

If you create links on multiple areas pointing to the same piece of content you might find that some of your links aren't consistent.  You can verify that your links are consistent using this query and swapping out Expense and Award for your commonly used link titles:
SELECT SECTION.Title, SECTION2.Title as Parent, SMI.URL from SECTION
INNER JOIN SECTION_PROPERTIES_SIDEMENUITEM as SMI
on SECTION.SectionID=SMI.SectionID
INNER JOIN SECTION as SECTION2
on SECTION.ParentID=SECTION2.SectionID
WHERE SECTION.TypeID='3' and (SECTION.Title like 'Expense%' OR SECTION.Title like 'Award%')
ORDER BY SECTION.Title

Inconsistent Category Options

Within a category there are a series of options which can be set including things like sort order.  If you have a large intranet and you deviate from the defaults you might want to verify that your categories are somewhat consistent.  You can access the consistency of your categories using this query and swapping out the red text with however you've set your default options:
SELECT SECTION2.Title as Parent, SECTION.Title, SMI.ShowAuthor, SMI.DefaultOrdering, SMI.ShowPerPage, SMI.TemplateID FROM SECTION
INNER JOIN SECTION_PROPERTIES_SIDEMENUITEM as SMI
on SECTION.SectionID = SMI.SectionID
INNER JOIN SECTION as SECTION2
on SECTION.ParentID=SECTION2.SectionID
WHERE SECTION.TypeID='3' and SMI.TypeID='1' and (SMI.ShowAuthor!=1 or SMI.DefaultOrdering!=1 or SMI.ShowPerPage!=1 or SMI.TemplateID!=1)

What Categories Are Empty

Curious what categories on your site don't have any documents?
Sections >1790 (on my site) are admin and modules areas which is why I eliminated them.
SELECT SECTION.sectionID, Section2.Title as Parent, SECTION.Title FROM SECTION
INNER JOIN SECTION as section2
on SECTION.ParentID=section2.SectionID
WHERE SECTION.SectionID>'1790' and SECTION.Title not like ('%Home') and SECTION.TypeID='3'
and NOT EXISTS
(SELECT * FROM CONTENT_SECTION WHERE SECTION.SectionID=CONTENT_SECTION.SectionID)
ORDER BY Parent asc

User Last Login

Curious which users haven't logged into your site in the last few days, weeks months? This query will show the last time all users in your system logged in.
SELECT Surname, Firstname, DateLastAccessed from PERSON
ORDER BY DateLastAccessed desc

I'll continue to add to this list as I generate additional queries.  Feel free to lob out any suggestions for queries and I'll see if I can add them to the list.

1 comment:

  1. Here's another one that I've just started using. We want our documents to present with the same Options enabled (Keyword, Recommends and Up to Date). The others should be disabled for the most part.

    By adjusting the 1 or 0 values of the last part of the WHERE statement, administrators can easily see which documents meet their standards.

    I copied the output to an excel file and highlighted the offending fields before distributing to my project team.


    SELECT c.ContentID,
    c.title,
    s.Title as category,
    (p.Firstname + ' ' + p.Surname) as fullname,
    cpd.TemplateID,
    cpd.ShowAuthor,
    cpd.ShowRecommends,
    cpd.ShowKeywords,
    cpd.ShowStats,
    cpd.ShowRating,
    cpd.ShowUpToDate,
    cpd.ShowPoll,
    cpd.MandatoryRead,
    cpd.AllowComments,
    c.active
    FROM content as c
    LEFT OUTER JOIN CONTENT_PROPERTIES_DOCUMENT as cpd ON cpd.contentid = c.contentid
    INNER JOIN CONTENT_SECTION as cs ON c.contentid=cs.ContentID
    INNER JOIN SECTION as s ON cs.sectionid = s.sectionid
    INNER JOIN person as p ON c.ownerid = p.PersonID
    AND cpd.TemplateID IS NOT NULL
    AND c.Archived=0
    AND (cpd.ShowAuthor=1
    or cpd.ShowRecommends = 0
    or cpd.ShowKeywords = 0
    or cpd.ShowStats = 1
    or cpd.ShowRating = 1
    or cpd.ShowUpToDate = 0
    or cpd.ShowPoll=1
    or cpd.MandatoryRead = 1
    or cpd.AllowComments = 1)
    ORDER BY (p.Firstname + ' ' + p.Surname), s.Title, c.title

    ReplyDelete