• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 6. Fundamentals of Report Format... > Crystal Reports in the Real World—Re...

Crystal Reports in the Real World—Referencing External Resources

A very powerful use of hyperlinks is to be able to take advantage of the many resources on the Internet. Many Internet sites make use of what is called a QueryString. By knowing the URL and QueryString that drive a particular site, a report hyperlink can be customized to open a Web site and perform some functionality. In the next example, the address of the sample customers can be opened in MapQuest.com by using a hyperlink:

Start with opening the report Chap6PostFormat.rpt. From the Insert menu, choose Text Object. Add the text MapQuest to the report.

Right-click the newly added text object and choose Format Tex. Then click the Hyperlink tab and click the x+2 button. See Figure 6.18 for an example of what the formula should look like. Enter the following code into the text:

StringVar URL;

// The prefix of the URL that will not change; it is hard-coded to the USA
URL := "http://www.mapquest.com/maps/map.adp?";
URL := URL & "country=US&countryid=250&adtohistory=";

// Add the street address
URL := URL & "&address=" & {Customer.Address1};

// Add the city
URL := URL & "&city=" &  {Customer.City};

// Add the state
URL := URL & "&state=" & {Customer.Region};

// Add the ZIP code
URL := URL & "&zipcode=" & {Customer.Postal Code};

// Add the suffix of the URL
URL := URL & "&submit=Get Map";


Figure 6.18. Code that builds a dynamic data driven URL that will enable hyperlinks to the Mapquest Web site from a Crystal Report

Click Save and Close to close the code window. Click OK to close the Format Editor window. Format the hyperlink using the same method used to format the e-mail address to show the user it is an actionable item.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint