Introducing Sub-Tags for WebReports
One of the most important facets of WebReports - and by extension the ActiveView module - is the extensive library of sub-tags available. But what is a sub-tag, and why are they an integral part of WebReports? In this blog post I explain the basics of WebReports sub-tags. If you'd like to learn more about our Sub-Tag Loader and Sub-Tag Suite product offering, you can check out the Productivity Suite product page.
What is a WebReports sub-tag
At its most basic level of functionality, a WebReports sub-tag allows you to enhance or format data being returned by any WebReports data tag. To provide an analogy, if you are using a spreadsheet and you have a raw number in a spreadsheet cell, you can apply formatting or functions to convert the raw number into a dollar value or percentage, as well as rounding off numbers etc. Similarly sub-tags allow you to operate on data that would otherwise be in a raw format. This is a very common type of sub-tag but as we’ll describe in this blog, sub-tags provide much more than this.
Syntactically, sub-tags are used as shown in red in this example:
[LL_REPTAG=Total ROUND:3 /]
As shown in this example, each sub-tag is separated from the tag and any other sub-tags using one or more spaces. Additionally, each sub-tag can support one or more parameters separated with a colon. If a sub-tag parameter needs to include a space or a colon, quotes can be used like this:
[LL_REPTAG=Total DECODE:0:”{ 0 }” /]
What are the different types of sub-tags?
The current library of sub-tags that comes with the WebReports module has over 170 sub-tags. There is extremely detailed documentation available for each and every sub-tag but in general these sub-tags can be broken down into the following 3 (slightly simplistic) categories:
- Formatting: This category covers all sub-tags that operate on the data returned by the tag. There are many different examples of this but in general they receive some form of data and create modified data to output (or to pass to the next sub-tag).
- Content Server API Lookups: Several of the sub-tags expect a Content Server ID of some kind (e.g. DataId) and use this ID to lookup related information for that particular object. For example: [LL_REPTAG=DataId NODEINFO:SUBTYPE /] uses the DataId for an object to lookup its sub-type. Some variants of this can return a set of contextual information. For example, LLURL:FUNCTIONMENU returns a full set of HTML to create a Content Server function menu.
- Action Sub-tags: This category represents a large set of sub-tags that are designed to act on (change) Content Server objects, or to write to Content Server in some way. These sub-tags have a slightly different behavior and handling as they may not necessarily return any data for output. As a slight variation of action sub-tags, there is a group of sub-tags that are used to set and change variables within the WebReports development scope.
How do sub-tags interact with each other?
More often than not, multiple sub-tags will be used together inside a tag declaration. A chain of sub-tags is treated like a pipeline moving from left to right. Each sub-tag receives data from the object to its left (the data tag or another sub-tag) and then passes its output to the next sub-tag. The output from the last sub-tag to the right is what will be output by the WebReport. For example, given this (somewhat nonsensical) example:
[LL_REPTAG=Total ROUND:CEIL INC ODDEVEN /]
If the data tag returned a value of 26.45 we would see the following data changes:
26.45 -- ROUND:CEIL → 27 -- INC → 28 -- ODDEVEN → EVEN
How can you extend sub-tags?
Despite the extensive built-in library of sub-tags available in WebReports, there are often new features that you might want in addition to these existing sub-tags.
While it is possible to customize the WebReports, RKTEngine object hierarchy, there is a mechanism that allows developers to “drop-in” new sub-tags, subject to a defined framework and standards. On start-up, WebReports will load any drop-ins so they can become part of the existing library of sub-tags, while those that already exist with the same name are simply overwritten.
This feature was originally provided as a way to deliver discrete improvements or fixes to existing sub-tags in between releases or patches; however, it also provides a safe and effective way to extend the WebReports sub-tag API.
Expand your WebReports functionality, improve your productivity
While this extensibility is relatively easy and useful, coding new sub-tags still requires OScript coding knowledge. To get you started, I have published a blog post for developers to give you a lot more detail on this useful capability. Find it here.
As you can see, the WebReports sub-tag architecture expands the vast existing functionality of WebReports and adds a significant number (hundreds) of useful features. Leveraging this extensive library of tags and sub-tags can be pretty daunting but we’re here to assist and guide you through any WebReports development needs.
Ask us about our newly revamped training courses for more of this type of information. We were involved in building the original (now delivered by OpenText) WebReports training and we've revised this training program to bring it up-to-date with the latest features and techniques.
Ravenblack Technical Services also provides advice and or support for any development you undertake in WebReports (or Content Intelligence if you prefer). As the driving force behind WebReports drawing from over 15 years of experience, we’re the best option on the market. To find out more, contact us today and gain the experience only available through pure mastery over WebReports.