ColdFusion

ColdFusion application servers can use either the .NET Corda® Embedder (Windows*) or the Java* Corda Embedder (other platforms). In either case, the code is very similar.

Embedding a Corda image into a ColdFusion* page can be broken down into the following steps:

The example code at the end of this section shows how to embed a Corda image in ColdFusion using either .NET or Java.

Note: This documentation assumes that you are familiar with ColdFusion.

Installing the Library

The instructions for installing the Corda Embedder differ according to which version you use.

.NET Corda Embedder (Windows)

When using ColdFusion MX on Windows, be sure you have updated the server to the latest version using the ColdFusion MX Updater Release 1, available at http://www.macromedia.com/support/coldfusion/releasenotes/mx/releasenotes_mx_updater.html. Apply this update to fix a bug in ColdFusion MX that prevents it from accessing Window’s COM.

In order to use Corda Embedder in COM-aware environments such as ColdFusion, register the .NET Corda Embedder as a COM component. This lets you access the .NET Corda Embedder from ASPs or other Web Applications that rely on COM.

Prior to doing this, you must first install the .NET SDK and then install the .NET Corda Embedder using the instructions in the text file located at <product_root>\Server\dev_tools\embedder\dotnet\COMInteropInstall.txt.

Java Corda Embedder (other platforms)

Note: Only available with PopChart® Enterprise.

Put the CordaEmbedder.jar file, located in the dev_tools/embedder/java folder, in the classpath of a Java Application Server. For more information, see Using the Java Corda Embedder in the Corda 7 Install and Administration manual.

Instantiating a Corda Embedder Object

To instantiate a Corda Embedder object on ColdFusion, use the <cfobject> tag. Set the name attribute of this tag to the name of the Corda Embedder object (e.g., myImage) and the action attribute to Create.

The values of the other attributes of this tag depends upon the version of Corda Embedder that you use.

.NET Corda Embedder (Windows)

Set the type attribute to COM and the class attribute to Corda.Embedder .

<cfobject type="COM" action="Create" name="myImage" Class="Corda.Embedder">

Java Corda Embedder (Other Platforms)

Set the type attribute to Java and the class attribute to com.corda.CordaEmbedder .

<cfobject type="Java" action="Create" name="myImage" class="com.corda.CordaEmbedder">

Note: You do not need to close the cfobject tag (i.e., do not use a </cfobject> tag).

Delimiting the Code For a Corda Image

Except for instantiating the Corda Embedder object and writing the embedding HTML to the Web page, all Corda Embedder code should go inside of a <cfscript> tag, as in the following code segment:

<cfscript>

myImage.imageTemplate = "image_templates\examples\line.itxml";

myImage.loadITXML("http://myserver.com/?graph1");

</cfscript>

Syntax Notes

Although almost all of the code looks the same in ColdFusion for the Java and .NET versions of Corda Embedder, remember that code that uses the Java Corda Embedder acts like Java code, while code that uses the .NET Corda Embedder acts like COM code.

When Corda Embedder methods that act differently between the Java and .NET versions (e.g., setDBQuery), make sure to use the correct syntax. If you add additional code, be sure that it conforms to the syntax of the language you have chosen. For more information about using the .NET Corda Embedder. see ASP Syntax Differences.

Setting the Server Information

Corda Embedder needs to know two Corda Server™ addresses: the address that the Web client uses to access Corda Server (externalServerAddress), and the address that Corda Embedder uses to access Corda Server (internalCommPortAddress). For more information about determining these addresses, see Identifying Server Addresses.

For example, if the Corda Embedder communicates with Corda Server at 10.0.1.1:2002, and Web clients request images from http://<server_address>:2001, include the following in the code that generates the Corda image:

myImage.externalServerAddress = "http://<server_address>:2001";

myImage.internalCommPortAddress = "10.0.1.1:2002";

Specifying Image Information

After specifying server address information, give Corda Embedder some information about the Corda image you want to embed.

There are numerous Corda Embedder commands to specify image information, which are consistent in all Web application environments (with the exception of several syntax differences, as previously explained in Syntax Notes). Thus, it is unnecessary to discuss each of these commands individually at this time.

The table below provides links to more information about Corda image features and components:

Topic

Where To Go

Annotations

Data Annotations in the Corda Builder™ User Guide

Content Delivery / Presentation Control

Image Deployment Issues and Descriptive Text Settings

Data

Connecting to Data Files and Connecting to Databases

Drilldown

Building Drilldown

Graph or Map Customization

Dynamically Customizing Graphs and Maps

Image Size & Format

Changing the Image Format and Changing Image Size

Important: When using ColdFusion MX with the .NET Corda Embedder, setting the height and width attributes causes an error. This is due to a bug in ColdFusion MX that does not allow the passing of integers to a COM object. Until this bug is fixed, use the two string attributes in the COM Object instead. They are called height4MX and width4MX (for example, myImage.height4MX = "350";).

Writing the Image to a Web Page

When you are ready to write the embedding HTML to the ColdFusion page, output the getEmbeddingHTML method. To do this, use the <cfoutput> tag. For example:

<cfoutput>#myImage.getEmbeddingHTML()#</cfoutput>

Note: Put pound signs before and after the myImage.getEmbeddingHTML() statement.

Complete Example Code

The sample code below demonstrates embedding a Corda image with ColdFusion (.NET).

Note: To produce an example map instead of a graph, replace examples/bar.itxml with examples/map/australia_combo.itxml in the code designating the Image Template file.

Embedding a Corda Image with ColdFusion (.NET)

<html>

<head>

<title>My First Embedded Image</title>

</head>

<body>

<h1>This is your image</h1>

<hr />

 

<!-- insert embedder code here -->

<cfobject type="COM" action="create" name="Chart" Class="Corda.Embedder">

<cfscript>

myImage.externalServerAddress="<server_address>:2001";

myImage.internalCommPortAddress = "localhost:2002";

myImage.imageTemplate = "image_templates\examples\bar.itxml";

myImage.width = 600;

myImage.height = 400;

myImage.pcScript = "title.setText(Hello World)";

</cfscript>

<cfoutput>

#myImage.getEmbeddingHTML()#

</cfoutput>

 

<hr />

<p>If you see an image above, congratulations. You have successfully embedded your first image.</p>

</body>

</html>

The code sample below demonstrates embedding a Corda image with ColdFusion (Java).

Embedding a Corda Image with ColdFusion (Java)

<html>

<head>

<title>My First Embedded Image</title>

</head>

<body>

<h1>This is your image</h1>

<hr />

<!-- insert embedder code here -->

<cfobject TYPE="Java" ACTION="Create" CLASS="com.corda.CordaEmbedder" NAME="myImage">

<cfscript>

myImage.externalServerAddress="<server_address>:2001";

myImage.internalCommPortAddress = "localhost:2002";

myImage.imageTemplate = "image_templates\examples\bar.itxml";

myImage.width = 600;

myImage.height = 400;

myImage.pcScript = "title.setText(Hello World)";

</cfscript>

<cfoutput>

#myImage.getEmbeddingHTML()#

</cfoutput>

 

<hr />

<p>If you see an image above, congratulations.  You have successfully embedded your first image.</p>

</body>

</html>