Friday, April 3, 2015

AngularJS Expand/Collapse All Rows in a Hierarchical Table

I've been working with AngularJS lately as an alternative to the traditional way of displaying and editing data in SharePoint. In particular I've been using this framework with custom web services as a quick way of accessing and editing information not stored in SharePoint.

One of these external sources of data which I needed to display within my SharePoint site consists of dealership information, including the brands and product types that they are active in. So, to begin with, I created a web service that returned hierarchical JSON consisting of dealers and their brand/product combinations. A somewhat simplified example looked like the following:

[
  {
    "DealerID": 1,
    "Dealer Name": "Dealer 1",
    "Address": "123 Main St",
    "City": "Irvine",
    "State": "CA",
    "ZIP Code": 92603,
    "Brands": [
      {
        "Brand": "Brand A",
        "Product I": "",
        "Product II": "X",
        "Product III": "X",
        "Product IV": "X",
        "Product V": "X"
      },
      {
        "Brand": "Brand B",
        "Product I": "",
        "Product II": "",
        "Product III": "X",
        "Product IV": "",
        "Product V": "X"
      }
    ]
  },
  {
    "DealerID": 2,
    "Dealer Name": "Dealer 2",
    "Address": "456 2nd Av",
    "City": "Portland",
    "State": "OR",
    "ZIP Code": 97225,
    "Brands": [
      {
        "Brand": "Brand A",
        "Product I": "X",
        "Product II": "X",
        "Product III": "X",
        "Product IV": "",
        "Product V": "X"
      },
      {
        "Brand": "Brand C",
        "Product I": "",
        "Product II": "",
        "Product III": "X",
        "Product IV": "",
        "Product V": "X"
      },
      {
        "Brand": "Brand D",
        "Product I": "",
        "Product II": "",
        "Product III": "X",
        "Product IV": "X",
        "Product V": "X"
      }
    ]
  }, ...

In order to display this data I decided to use a hierarchical table layout, where one row would show the dealer information and the next row would contain a child table that would display the brand information. This was easily accomplished using Angular's ng-repeat-start for the first row and ng-repeat-end for the second, repeating this two-row pattern for all dealers.

Because ng-repeat produces a separate child scope for each dealer row, I could add a button element to a cell in the dealer row with an ng-click event that toggles an "expanded" property on the scope. The related brands table row could then be shown or hidden by setting the ng-show property equal to the scope's "expanded" property. In preparation for the expand/collapse all capability, I also added a button to the with an ng-click event that toggles an "allExpanded" property of the rootscope (which is largely impotent at this point). Something similar to the following:


<table>
    <tr>
        <th>
            <button type="button" ng-click="allExpanded = !allExpanded">
                <span ng-bind="allExpanded ? '-' : '+'"></span>
            </button>
        </th>
        <th>Dealer</th>
        <th>Address</th>
        <th>City</th>
        etc...
    </tr>
    <tr ng-repeat-start="dealer in ctrl.dealers>
        <td>
            <button ng-click="expanded = !expanded">
                <span ng-bind="expanded ? '-' : '+'"></span>
            </button>
         </td>
        <td>{{dealer.Dealer}}</td>
        <td>{{dealer.Address}}</td>
        <td>{{dealer.City}}</td>
        etc...
    </tr>
    <tr ng-repeat-end ng-show="expanded">
        <td colspan=5>
            <table>
                <tr>
                    <th>Brand</th>
                    <th>Product 1</th>
                    <th>Product 2</th>
                    etc..
                </tr>
                <tr ng-repeat="brand in dealer.Brands">
                    <td>{{brand.Brand}}</td>
                    <td>{{brand.Product1}}</td>
                    <td>{{brand.Product2}}</td>
                    etc..
                </tr>
            </table>
        </td>
    </tr>
</table>

So far, so easy with AngularJS!

Now for the part that wasn't so apparent and the reason for this post. How to create the expand/collapse all functionality. Googling mostly led to examples where the expanded state was being stored in the data model itself. In my example, this would mean adding an "expanded" attribute to each dealer object in my model which would make creating an expandAll function that could loop through all objects in the dealer model and setting the "expanded" attribute of each dealer object trivial. But I had no reason to pollute my dealer model with view state information. What I needed was a way to change the expanded property of each dealer row's scope based on the "allExpanded" property.


Enter Angular's $scope.broadcast and $scope.on


$scope.broadcast dispatches an event name down the scope hierarchy notifying the registered/subscribed listeners and takes an event name and an optional list of arguments. Using this method, I could create an expandAll function within my main controller (called by the ng-click event of the expand all button) to broadcast a change in the allExpanded property to all child scopes:


self.expandAll = function (expanded) {
    $scope.$broadcast('onExpandAll', {expanded: expanded});
};

On the receiving end, the $scope.on method listens for those broadcasted events. $scope.on takes the name of the event to listen for (e.g. "onExpandAll"), and an event listener function in the form of function(event, args). The "args" argument is used to access the arguments broadcasted in the $scope.$broadcast method. One way to accomplish this for the child scopes created by ng-repeat, is to create an "expand" directive.

.directive('expand', function () {
    function link(scope, element, attrs) {
        scope.$on('onExpandAll', function (event, args) {
            scope.expanded = args.expanded;
        });
    }
    return {
        link: link
    };
});

This directive can then be placed as an attribute on an element within the ng-repeat... I chose the expand button that is created for each dealer row. 

<tr ng-repeat-start="dealer in ctrl.dealers">
    <td>
        <button ng-click="expanded = !expanded" expand>
            <span ng-bind="expanded ? '-' : '+'"></span>
        </button>
    </td>
    ...

And viola...



For a complete listing of the code and a working example, check out the Plunker: 
http://plnkr.co/edit/qqNGSbw6oLUZbKqVQVpG?p=preview

Note, for my project (and this example), I used Angular 1.2.28 because I needed to support Internet Explorer 8.

Finally, although it wasn't required for my project, an interesting next step would be to convert this logic to work with hierarchical JSON that went deeper than a single child level, allowing each child to expand all of its children and so on.

Sunday, December 14, 2014

Mimicking PerformancePoint Filter Connection Formulas using the Query String (URL) Filter

In this post, I'm going to show you an easy trick using SharePoint's Query String (URL) Filter to create complex and dynamic dashboard filter connections for PerformancePoint Scorecards and Reports.

If you‘ve built any PerformancePoint dashboards, you’ve undoubtedly created and connected PerformancePoint Filters to scorecards and reports (Analytic Grids, Analytic Charts, Reporting Services Reports, etc.) to create powerful and interactive dashboards.

A simple (and maybe not so powerful) example, which I will build upon, would be creating a Customer Country filter using the AdventureWorks SSAS multi-dimensional database and connecting it to an Analytic Grid report summarizing data based on the Customer dimension's Customer Geography hierarchy, as in the figure below:

PerformancePoint Filter and Analytic Grid
Figure 1: A Not So Powerful Example of Using a PerformancePoint Filter
Slightly less common is utilizing a PerformancePoint Filter’s Connection Formula to filter a report in a more sophisticated manner using MDX functions (see Extend PerformancePoint dashboards by using MDX queries for a thorough explanation of Connection Formulas). For example, you could add the following simple MDX function as a Connection Formula to modify the filter connection created above:
<<UniqueName>>.Children
This formula would apply the Children MDX function to the value of the filter and when applied to the Customer Geography hierarchy, would summarize the measures by State-Province (i.e., the child level of Country).

Analytic Grid results using PerformancePoint Filter with a Connection Formula
Figure 2: A More Powerful Example Using a PerformancePoint Filter with a Connection Formula

The Query String (URL) Filter


Another filter that can be useful for PerformancePoint Dashboards is SharePoint's Query String (URL) Filter. This filter allows you to access a query string parameter and pass its value to a connected PerformancePoint Scorecard or Report. I use Query String (URL) Filters for a couple of different scenarios: one is when I want to link dashboards based on an attribute hierarchy by having a hyperlink on a dashboard (e.g., in an embedded SSRS report) which navigates to, for example, a dashboard focusing on a particular parent or child geographic area. The other scenario is when I have a parameter with hundreds or thousands of options (e.g., counties) and instead of populating a PerformancePoint Filter, I use a custom search box control to set a query string argument which is used to filter the dashboard. There are certainly drawbacks to this filter, like having to reload a page or having an attribute member value exposed in a URL, but it is also very powerful and it can open up new possibilities in your dashboard design.

Using this filter is fairly straightforward allowing you to add the filter to your dashboard and specify the query string parameter name. 

Query String (URL) Web Part Editor
Figure 3: Query String (URL) Filter Web Part Editor
By passing an attribute member value (e.g., [Geography].[Geography].[Country].&[United States]) in the “area” query string parameter, we can accomplish the same thing that the PerformancePoint Filter did without the Connection Formula. The URL would look something like the following, where "area" is the name of the query string parameter (make sure to URL encode the parameter value, otherwise it may not work):
http://servername/site/subsite/Dashboards/AdventureWorks/Page1.aspx?area=%5BCustomer%5D.%5BCustomer+Geography%5D.%5BCountry%5D.%26%5BUnited+States%5D
Using this type of filter opens up the possibility of dynamically controlling what is being summarized in a report via the URL. The problem with this approach, however, occurs when you want to create a more sophisticated filter using something similar to the PerformancePoint Filter's Connection Formula. There is no interface to enter a Connection Formula for a Query String (URL) Filter, so it can't be done. At least that's what I thought until recently when I started playing with the query string parameter value and discovered that I could apply MDX functions directly in the URL.
For example, we can use the same Children MDX function used above directly in the URL, passing [Geography].[Geography].[Country].&[United States].Children as the query string value. The URL encoded query string would look like the following:
http://servername/site/subsite/Dashboards/AdventureWorks/Page1.aspx?area=%5BCustomer%5D.%5BCustomer+Geography%5D.%5BCountry%5D.%26%5BUnited+States%5D.Children
This allows us to produce the exact same results as when we used the PerformancePoint Filter with the Children MDX function in the Connection Formula, as shown below:
Producing the Same Results Using a PerformancePoint Filter and a Query String (URL) Filter.
Figure 4: Producing the Same Results Using a PerformancePoint Filter (left) and a Query String (URL) Filter (right)
With this knowledge, I began to try slightly more complicated MDX formulas. For example, I could pass TopCount({Descendants([Customer].[Customer Geography].[Country].&[United States], 2)}, 10, [Measures].[Internet Order Count]) to get the top 10 U.S. cities based on Internet Order Count. The URL encoded string would look like:
http://servername/site/subsite/Dashboards/AdventureWorks/Page1.aspx?area=TopCount%28%7BDescendants%28%5BCustomer%5D.%5BCustomer+Geography%5D.%5BCountry%5D.%26%5BUnited+States%5D%2C+2%29%7D%2C+10%2C+%5BMeasures%5D.%5BInternet+Order+Count%5D%29
This would produce something similar to the following:

PerformacePoint Analytic Grid using a Query String (URL) Filter with a more complicated MDX function
Figure 5: Top 10 U.S. Cities Based on Internet Order Count (right side)

By this point
you can see that there is great potential in using a Query String (URL) Filter with MDX functions. Using this trick you can create very dynamic dashboards which can be controlled using query string parameters instead of having to hard code a conditional formula into PerformancePoint Filter. Just remember, as with anytime you are passing query string parameters in a URL, make sure that you understand how a savvy user may try to modify it to gain access to information that you did not intend.

Sunday, November 23, 2014

SSRS: Filling in Cells of Reports Exported to Excel (Part 2)

In my last post, SSRS: Filling in Cells of Reports Exported to Excel (Part 1), I showed how to fill in the cells of a block formatted report that has been exported to Excel. In this post we'll do the same thing for a stepped formatted report.

A stepped format displays row groups in staggered columns as in the example below:



Multi-column stepped format SSRS report example
Multi-Column Stepped Format
When this report is exported to Excel, it will look very similar to the report layout using merged cells to accomplish the formatting. To fill in the empty cells, follow the steps below:

NOTE: In order for the selection of blank cells in the steps below to work, you may need to enter "=Nothing" as the expression in the row group text boxes highlighted in red below:


Highlighted text boxes in SSRS report indicating where to place "=Nothing" formula.
Stepped Format Report Design
  • Click the Enable Editing button (if necessary)
  • Select the cells for the entire worksheet
  • From the Home tab, click Merge & Center -> Unmerge Cells
  • You may want to widen the columns that contain the row groups (i.e., row labels), so that you can see the entire contents of the cells
NOTE: Here is where you may want to re-evaluate your report design. If Excel has had to create merged column cells in your table to accommodate lining up header images, report titles, etc., you may want to try to avoid that. By doing things like conditionally formatting header images to not export to Excel, stretching title text boxes to be the same width as the tablix, etc., the report will export in a more Excel friendly format.
  • Select just the range of cells that represent the row groups (i.e., the row labels) of the tablix
  • From the Home tab, click Find & Select -> Go to Special… -> Blanks
At this point just the blank cells that represent the row groups should be selected as in the image below:

Highlighting blank cells in SSRS report exported to Excel
With Blank Cells Selected
  • Holding down the Ctrl key, select a highlighted blank cell
  • Click in the formula box and type =IF(LEN(A2), A2, 1/0) where A2 is the cell to the left of your selected cell (in my case B2). This formula states that if the cell next to the selected cell is populated with text, use that, otherwise fill the cell with 1/0 which will cause an Invalid Cell Reference Error
  • Holding down the Ctrl key, hit the Enter key (this will copy the formula to all selected cells)
At this point you will have some cells that have been filled in with the correct information and others that show a #REF! error.

Populating blank cells with formula in SSRS report exported to Excel
With Cells Filled In
  • With the cells still selected, click Find & Select -> Go to Special… -> Formulas -> Errors (i.e., uncheck the Numbers, Text and Logicals checkboxes)
Now only the #REF! error cells should be selected, as in the image below:


Selecting error cells in SSRS report exported to Excel
With Error Cells Selected
  • Holding down the Ctrl key, select a highlighted blank cell
  • Click in the formula box and type the equals sign (i.e., =) over the existing formula 
  • Click on the cell above the selected cell (e.g., if your selected cell is B5, click on B4)
  • Holding down the Ctrl key, hit the Enter key (this will copy the formula to all selected cells)
All of the cells should now be filled in with the appropriate data, as shown below:


Populating error cells with formula in SSRS report exported to Excel
With All Cells Filled In
  • Again, select just the range of cells that represent the row groups (i.e., the row labels)
  • From the Home tab, click Copy
  • Click Paste -> Values to replace the formulas with the actual values
You should now have a usable spreadsheet that you can sort, copy and paste rows into other worksheets, etc. Although it may have seemed like many steps to accomplish this task, once you've gone through it a couple of times, it will become a fairly simple Excel trick that you can add to your arsenal.

Sunday, November 9, 2014

SSRS: Filling in Cells of Reports Exported to Excel (Part 1)

Designing reports that have multiple row groups is a relatively common requirement in Reporting Services. This often means implementing either a block or multi-column stepped formatted report to display those groups (i.e., this post does not apply to a stepped format where all row groups appear in a single column using padding or spaces to offset the groups). The problem with these formats occurs once the report has been exported to Excel. To maintain the look of the report, Excel merges the cells of those row groups; however, to work with the data in Excel (e.g. sort, copy & paste selections into other worksheets, etc.) you’ll need to eventually unmerge those cells. Unfortunately, Excel doesn’t automatically fill in those unmerged cells with data where it exists. In part 1 of this 2-part post, I show how this can be accomplished for a block formatted report that has been exported to Excel.

A block format displays row groups in columns side by side as in the example below:



Block Format

When this report is exported to Excel, it will look very similar, using merged cells to accomplish the formatting. To fill in the cells, do the following after exporting the report to Excel:

  • Click the Enable Editing button (if necessary)
  • Select the cells for the entire worksheet
  • From the Home tab, click Merge & Center -> Unmerge

NOTE: Here is where you may want to re-evaluate your report design. If Excel has had to create merged column cells in your table to accommodate lining up header images, report titles, etc., you may want to try to prevent that. By doing things like conditionally formatting header images to not export to Excel, stretching title textboxes to be the same width as the tablix, etc., the report will export in a more Excel friendly format.
  • Select just the range of cells that represent the row groups (i.e., the row labels) of the tablix
  • From the Home tab, click Find & Select -> Go to Special… -> Blanks
At this point just the blank cells that represent the row groups should be selected as in the image below:

Blank Cells Selected
  • Holding down the Ctrl key, select a highlighted blank cell
  • Click in the formula box and type the equals sign (i.e., =)
  • Click on the cell above the selected cell (e.g., if your selected cell is C3, click on C2)
  • Holding down the Ctrl key, hit the Enter key (this will copy the formula to all selected cells)
With Cells Filled In
  • Again, select just the range of cells that represent the row groups (i.e., the row labels)
  • From the Home tab, click Copy
  • Click Paste -> Values to replace the formulas with the actual values
You should now have a usable spreadsheet that you can sort or copy and paste rows into other worksheets, etc.

In part 2 of this post, SSRS: Filling in Cells of Reports Exported to Excel (Part 2), I'll show how to do the same thing for a stepped formatted report, which is slightly more complicated.

Saturday, October 18, 2014

MDX: Top N by Group with All Others

When summarizing data using MDX, it’s a common requirement to find the top N by group (i.e., the top N tuples of one set for each member of another set). For example, you may need to find the top N brands by state or the top N products by calendar year based on sales count or amount. In MDX, this is accomplished using a combination of the Generate and TopCount functions. As an example, the following returns the top 5 products for each region based on sales amount:


WITH SET [Top N Products] AS
    Generate(
        [Sales Territory].[Sales Territory Region].Children
 , TopCount( 
            [Sales Territory].[Sales Territory Region].CurrentMember
  * [Product].[Product Categories].[Product].MEMBERS
            , 5
            , ( [Measures].[Internet Sales Amount] )
        ) 
    )
SELECT { [Measures].[Internet Sales Amount] } ON COLUMNS,
    NON EMPTY { [Top N Products] }  ON ROWS
FROM [Adventure Works]


This commonly available query uses the Generate function to evaluate the set produced by the TopCount of the cross product of regions and products, and applies it to each of the region member's children. This produces the following results:

Results of a Top N by Group MDX Query
Top N by Group Results

But this only provides part of the picture. Typically, I would want to include all other products within each region as well so that I could provide context to the top N items. For example, in a report (which could also be accomplished using MDX... but let's keep the MDX straightforward for this post) I could calculate each product's percent of sales within each region or each region's percent of sales versus all sales. In order to produce the all other products row for each region, we need to create a new calculated member (i.e., [All Other Products]) using the Aggregate and Except functions.

WITH SET [Top N Products] AS
    Generate(
        [Sales Territory].[Sales Territory Region].Children
 , TopCount( 
            [Sales Territory].[Sales Territory Region].CurrentMember
  * [Product].[Product Categories].[Product].MEMBERS
            , 5
            , ( [Measures].[Internet Sales Amount] )
        ) 
    )
    MEMBER [Product].[Product Categories].[All Other Products] AS 
 Aggregate( 
     Except( 
  NonEmpty( 
             { [Sales Territory].[Sales Territory Region].CurrentMember 
      * [Product].[Product Categories].[Product].MEMBERS } 
  )
  , [Top N Products] 
     )
 )
SELECT { [Measures].[Internet Sales Amount] } ON COLUMNS,
    NON EMPTY { 
 [Top N Products]
 , ( 
     [Sales Territory].[Sales Territory Region].[Sales Territory Region] 
     , [All Other Products] 
 ) 
    } ON ROWS
FROM [Adventure Works]

The Aggregate function takes a set (e.g., the cross product of region and product) and aggregates a measure (e.g., sales amount) within the current context. However, we additionally must use the Except function to exclude the top N products for each region from the aggregate. 

While the NonEmpty function within the Except doesn't make a difference in this example, it can provide a significant performance gain depending on the cross product that is being evaluated.

This query results in the following (as a note, I did use an Order function so that All Other Products would sort within each group, but I left it out of the MDX to keep the example clear):

Results of a Top N by Group with All Others MDX Query
Top N by Group with All Others Results

Although the MDX is a little more complicated, the results are much more useful, providing a basis for creating context for your top N values.

Wednesday, September 17, 2014

Migrating a Visual Studio 2003 ASP.NET Project to Visual Studio 2013 and IIS Express

Recently I had to migrate a Visual Studio 2003 ASP.Net project to Visual Studio 2013. I know, so many questions… why hadn’t this project ever been migrated in the past, how did a project survive so long without getting migrated, how is this guy still employed, etc. All great questions. The simple answer is that I had some old projects on an old XP machine that gave up the ghost. I therefore had to migrate the projects to another machine where I had Visual Studio 2013 using IIS Express installed.

Like any good developer, I did not research what issues I might face in making such a leap forward. I just went ahead and tried to open the old project in Visual Studio 2013, hoping that the Microsoft engineers who designed Visual Studio would have had the forethought to imagine that someone would try something so ridiculous. However, after 20 seconds of Visual Studio contemplating what to do with my request, it responded with an error messagebox stating the following:


The operation could not be completed. The system cannot find the path 
specified.

Not very helpful. Fortunately, after clicking OK on the above message, the Migration Report (updatelog.htm) opened automatically and provided me with the following error that was a little more useful:

MyProjectName.csproj: Could not find the server 'http://localhost/MyProjectName/MyProjectName.csproj' on the local machine. Creating a virtual directory is only supported on the local IIS server.


Kind of made sense. I was moving from a development environment that used IIS 6 to one that used IIS Express. A Google search of that error yielded many results, but none that were specific to migrating a project and pertinent to my situation. So instead I rooted around my project's files to figure out where it was picking up the virtual directory information and quickly found the project’s .webinfo file (i.e., MyProjectName.csproj.webinfo). The .webinfo file (something I never really paid attention to before) is a developer specific file that keeps track of the project’s virtual root location. It's contents look like this:

<VisualStudioUNCWeb>
    <Web URLPath = "http://localhost/MyProjectName/MyProjectName.csproj" />
</VisualStudioUNCWeb>

So I threw caution to the wind and experimented. I renamed the .webinfo file (e.g. @ MyProjectName.csproj.webinfo) and tried to open the .csproj file again. This time Visual Studio 2013 quickly responded with the following informative messagebox:

You have completed the first step in converting your Visual Studio .NET 2003 
web project. To complete the conversion, please select your project in the 
Solution Explorer and choose the 'Convert to Web Application' context menu 
item.

The Migration Report that followed additionally gave a few warnings regarding making “non-functional changes without impacting project behavior”. But everything seemed to work fine when I attempted to run it and, as it turned out, there was no need to convert the project to a web application.

However, when running the project, the pages were running from the root of localhost rather than in a virtual directory like I was used to seeing in the VS2003 development environment. As an optional step, this simply required editing the Project URL (e.g. adding MyProjectName to the URL) from the project's properties Web tab (i.e. right-click the project, select Properties and then the Web tab) and clicking the Create Virtual Directory button.

Next stop for my migrated project: refactoring EVERYTHING.

Tuesday, August 12, 2014

Downloading and Extracting US Census Bureau TIGER/Line Shapefiles

The United States Census Bureau (census.gov) site is a great resource for free spatial data such as state, county, census tract, etc. boundary files. These files can be used as is or used as a building block for creating custom sales territories. They can be loaded into SQL Server for use in spatial queries or for displaying boundaries on a map in an SSRS report. They can also be used to build map tiles for use with the Bing Maps API. This post, however, is focused on downloading and extracting these files.

These TIGER (Topologically Integrated Geographic Encoding and Referencing)/Line Shapefiles are available in many vintages, including definitions from the 1990, 2000 and 2010 censuses, with annual updates through 2013 (2014 should be available soon). The Census Bureau site provides several ways to access and download these files, but the easiest way is to use their FTP site (ftp://ftp2.census.gov/).

You can use an FTP client or, as shown here, you can simply use Windows Explorer.

Start by opening Windows Explorer and pasting ftp://ftp2.census.gov/ directly into the address bar. 

Navigate to the geo/tiger/. From this folder you will see the different vintages of TIGER files available. To illustrate the next step, lets say we're interested in the 2013 Census Tract boundaries.

Navigate to the TIGER2013/TRACT folder. In the right hand window (i.e. file list), you'll see a list of compressed (.zip) files with names based on the State FIPS Code, which is a two character numeric code assigned to each state, the District of Columbia and outlying areas of the U.S. (Puerto Rico, Guam, etc.).

Select the ZIP files you're interested in. I'm only interested in the U.S. states and DC, so I'm selecting files tl_2013_01.zip (AL) through tl_2013_56.zip (WY).

Right-click one of the selected files and select Copy from the popup menu.

Navigate to a folder on your local network, right-click the folder and select Paste. This may take a few minutes. I'll wait.

Now that you have the files on your local network, we need to extract (i.e. unzip) them. Unfortunately Windows Explorer falls short when needing to unzip multiple files. If you already have WinZIP or WINRAR installed, you could use either of those to unzip multiple files. I don't, so I'm going to use the following PowerShell script that I found on Steve Schofield's Blog

function UnZipMe($zipfilename,$destination) 
{ 
    $shellApplication = new-object -com shell.application 
    $zipPackage = $shellApplication.NameSpace($zipfilename) 
    $destinationFolder = $shellApplication.NameSpace($destination) 

    # CopyHere vOptions Flag # 4 - Do not display a progress dialog box. 
    # 16 - Respond with "Yes to All" for any dialog box that is displayed. 

    $destinationFolder.CopyHere($zipPackage.Items(),20) 
} 

# replace the following with the folder that contains your zipped files
$a = gci -Path C:\Data\USCBCensusTracts2013 -Filter *.zip 

foreach($file in $a) 
{ 
    Write-Host "Processing - $file" 
    UnZipMe –zipfilename $file.FullName -destination $file.DirectoryName 
}

Once this script finishes running, you will have all of your shapefiles ready to work with.