In this recipe, we will introduce you to the 'Hyperlink' component.
A report shows retailers information by products. It shows various fields like Retailer name, Contact information, City, and Postal zone. Business wants to have a link to Google maps that will show retailer's place on the map using the Postal zone information.
As the addresses might change in the backend, the technique needs to be dynamic to pick up the latest postal zone.
'http://maps.google.com/maps?q=' + [Query1].[City]
As you can see, there is a link for each retailer record. If you Shift+click on the link, it will open the Google map for corresponding postal zone in a new window.
Here we are using the 'Hyperlink' component of CRS. We can define the URL as any static link.
However, for our requirements, we have defined a report expression. This allows us to provide a dynamic link which picks up the latest postal zone from the database. We are passing the postal zone to Google Maps as part of a URL.
The hyperlink component works in HTML as well as Excel and PDF formats of report. This object currently does not have the property to define whether the link target should open in a new window or the same window. Just clicking on the link, opens the target in same window; whereas Shift+click opens in a new window.