Querystring Fun

Blog Post created by pkaiser Employee on Jan 27, 2009

Querystrings have long offered the opportunity to make configurable web pages, allowing name-value pairs to be tacked on to the end of a page's URL. RFC 1738 (December 1994) describes a "searchpart" as a "query string" that follows a "?" delimiter in an HTTP URL. As a tried-and-true mechanism for passing parameters in URLs, there is of course some support for querystrings in the RtWebParts product.


Many of our customers are familiar with the querystring parameters that can be passed to instances of the RtTimeRange and RtTreeView web parts (if you're not familiar with these, check the product documentation). However, fewer realize that RtWebParts v2.0 introduced a querystring-enabled version of our ad-hoc trend page. Sure, you can invoke an ad-hoc trend from many of our web parts, but there is also a well-known URL to an ad-hoc trend page that can receive start time, end time, and a list of PI tags to trace via the URL. This mechanism is applied by our PI Notifications product to include a link to an applicable trend within a notification email.


The well-known URL for this querystring-enabled ad-hoc trend page is:




Where the <SharePointServer> placeholder represents the name of the SharePoint server where RtWebParts has been installed.


As stated, this page supports three querystring parameters to configure it's appearance:

  • StartTime - UTC seconds or any other time format supported by RtWebParts, such as "*-2h"
  • EndTime - UTC seconds or any other time format supported by RtWebParts, such as "*"
  • Data - A list of one or more PI tags with no delimiter, of the format \\server\tag[\\server\tag]

For example, if your SharePoint server is named "mywebparts", and you want to trace the "sinusoid" and "cdt158" tags from a PI server named "mydata" over the last 12 hours, you would use the following URL:




The StartTime and Data parameters must be provided in the querystring, but if the EndTime is omitted the ad-hoc trend will assume an end time of "*".


As I mentioned, ad-hoc trends are available from the pull-down and right-click menus in several of our web parts. However, the configurability of the ad-hoc trend through its URL provides substantial integration opportunity through basic web mechanisms that need not originate from within web parts or even SharePoint. Of course the RtWebParts product must be installed to a SharePoint server, but once installed this ad-hoc trend is available without ever building a web part page. In short, if you've installed RtWebParts version 2.0 or later, the ability to integrate ad-hoc trending into your web applications using basic querystring parameterization is already available to you. How's that for Value Now?