Creating WebFOCUS Procedures for Maps

How to:

Before binding maps to a WebFOCUS source, you must predefine marker fields in a source file. The source can be a URL, XML file, or external procedure.

Markers are presented at run time on the map by placing an image at specific geographical points. Clicking on the map marker can result in a drill down to a source file, and optionally, a Tooltip can be presented when pausing on a map marker.

Markers are defined by the following:

Marker fields are displayed by an image, drill down, and/or Tooltips in the map.

Note: The following procedures are applicable for using Google Maps, Bing Maps, and ESRI JavaScript API Maps.


Top of page

x
Procedure: How to Create Map Latitude/Longitude Coordinates in the Source File

In order to plot points on the map, you must define each point by its latitude and longitude coordinates and associate a marker, or group assignment, to each point. The Source file must be XML format and must contain fields called LATITUDE, LONGITUDE and MARKER. Additional fields can be included for Tooltips or image icon information.

Note: The following example creates a source file for a map by:

  1. Join the Century Sales and Locale data sources.

    Tip: The Century Sales and Locale data sources are available from the Master Files folder in the ibidemo application folder. You may copy these source files to the project directory of your choice.

    1. Create a new procedure in Developer Studio:
      • With the Procedures folder highlighted, select New/Procedure from the File menu.

        or

      • Right-click the Procedures folder and select New/Procedure from the context menu.

      The Add Procedure dialog box opens.

    2. Enter gmlayer as the name for the new procedure in the File name field and click Open.

      The Procedure Viewer opens.

    3. Click a component connector (yellow diamond) and select Join.

      The Open dialog box appears.

    4. Select centurysales.mas and click Open.

      The Join dialog box opens.

    5. Select the Add File button from the Join toolbar.

      The File Description List for Join dialog box opens.

    6. Select locale.mas and click Open.

      Developer Studio automatically creates a Join between the data sources if they both have fields with the same formats. The Join tool displays both data sources and the default Joins, as shown in the following image.

      For more information about using the Join tool, see the Creating Reporting Applications With Developer Studio manual.

    7. Close the Join tool to save the Join and update the procedure.

      The Join is added to the Procedure Viewer.

  2. Group the location to the LINEPRICE field.
    1. From the Procedure Viewer, click a component connector (yellow diamond) and select Report.

      The Open dialog box appears.

    2. Select centurysales.mas and click Open.

      Report Painter opens.

    3. Select By from the Columns toolbar and double-click LATITUDE and LONGITUDE from the Object Inspector.

      If fields in your source are not called Latitude, Longitude, or Marker, you can:

      • Use the SET TOOL to Set ASNAMES = ON, to add AS Names in your procedure.
      • In Report Painter, right-click the field and select Column Title, to type in the correct name.
    4. Select Sum from the Columns toolbar and double-click LINEPRICE from the Object Inspector.
    5. Rename LINEPRICE to Line Total.

    Each location (Latitude and Longitude) has been grouped to LINEPRICE for the report.

  3. Save the report, but do not close it.

The following image is an example of a report with Latitude and Longitude coordinates.

The map Latitude and Longitude coordinates have been set. This source file will be selected as the source file from HTML Composer later on. For more information about selecting source files for a map, see Customizing the Map Properties.


Top of page

x
Procedure: How to Create Map Marker Group Fields and Tooltip Fields in the Source File

Marker and Tooltip fields can be computed fields, or any field from your data source.

Note: If you are using a field from your data source as the Marker field, the field name must be renamed Marker.

A COMPUTE field is a calculated value in the source file that is used as the Marker field in the map. A COMPUTE field uses an expression that can be used to assign a value to a field. You create a COMPUTE field by using the Computes tab of the Report Options dialog box.

Note: If the HTML page where your map resides is created in the Repository area and the marker images also reside in the Repository area, then a fully qualified path to the image files (starting with /WFC) is needed, if using a DEFINE/COMPUTE to determine the marker image. For example: IMAGE/A75='/WFC/repository/images/cust_'||IMAGE_COLOR||IMAGE_SIZE;

The following example creates marker fields and Tooltips fields by:

  1. Create markers, or group assignments, for each location.

    The Report Painter gmlayer.fex is still open. Create a COMPUTE field to assign an integer value determined by row-based values.

    1. From Report Painter, select Computes from the Report menu, or click the Computes button from the Setup toolbar.

      The Report Options dialog box opens at the Computes tab.

    2. Type LINEPRICE_CLASS as the Field name.
    3. Add a COMPUTE field to assign an integer based on the LINEPRICE value, as indicated in the following table.

      LINEPRICE

      Integer

      Marker

      0 - 999,999

      2

      redicon

      1,000,000 - 9,999,999

      3

      yellowicon

      10,000,000 - 49,000,000

      1

      greenicon

      50,000,000 or higher

      0

      blueicon

      Enter the syntax, as shown in the example image below, to use LINEPRICE to group the data:

      COMPUTE LINEPRICE_CLASS/I5 = IF LINEPRICE GE 50000000
        THEN 0 ELSE IF LINEPRICE GE 10000000
        THEN 1 ELSE IF LINEPRICE LE 1000000
        THEN 2 ELSE 3

    4. Click Apply.
  2. Associate each group to a marker.

    Create a new COMPUTE field that sets the Marker field with a DECODE statement to convert the numerical grouping into icon names.

    Note: A Marker field can also be any value field from your data source, but it must be renamed to Marker.

    1. Click New from the Computes tab.
    2. Type MARKER as the Field name.
    3. Enter the syntax, as shown in the example image below, to associate each group to a marker.
      COMPUTE MARKER/A10 = DECODE LINEPRICE_CLASS( 0 'blueicon' 1 'greenicon' 2 'redicon' ELSE 'yellowicon') ;

    4. Click Apply.
  3. Assign fields as Tooltips.

    Optionally, if you want to include a Tooltip, create an additional COMPUTE field to assign fields as Tooltips.

    Note: A Tooltip field can also be any value field from your data source.

    1. Click New from the Computes tab.
    2. Type REVENUE_RANGE as the Field name.
    3. Enter the syntax, as shown in the example image below, to include a Tooltip.
      COMPUTE REVENUE_RANGE/A10 = DECODE LINEPRICE_CLASS( 0 'OVER 50M' 1 '10M to 50M' 2 'UNDER 1M' ELSE '1M TO 10M') ;

    4. Click Apply.
  4. Click OK to close the Computes tab.

    The fields are added to the Computed fields folder in the Object Inspector and are automatically added to the report as LINEPRICE_CLASS, MARKER, and REVENUE_RANGE.

  5. Select Output from the Report menu.

    The Report Options dialog box opens at the Output tab.

  6. Select Standard XML (XML) from the Select Format drop-down list.

    Note: The XML output format is available from the Unstyled formats folder.

  7. Select Web browser from the Destination drop-down list.
  8. Click OK to close the Report Options dialog box.
  9. Save and close your report.

The following image is an example of a report with Marker fields and Tooltip fields set.



x
Procedure: How to Create the Starting Center Point of the Map

In addition to creating the Latitude or Longitude coordinates and associating markers, you must set the center view of the map to a bound geographical point at run time. Center values can be set dynamically or by a constant value.

Note: The following example creates a report that sets the starting point of your map by:

  1. Join the Century Sales and Locale data sources.

    Tip: The Century Sales and Locale data sources are available from the Master Files folder in the ibidemo application folder. You may copy these source files to the project directory of your choice.

    1. Create a new procedure in Developer Studio:
      • With the Procedures folder highlighted, select New/Procedure from the File menu.

        or

      • Right-click the Procedures folder and select New/Procedure from the context menu.

      The Add Procedure dialog box opens.

    2. Enter setcentervalue as the name for the new procedure in the File name field and click Open.

      The Procedure Viewer opens.

    3. Click a component connector (yellow diamond) and select Join.

      The Open dialog box appears.

    4. Select centurysales.mas and click Open.

      The Join dialog box opens.

    5. Select the Add File button from the Join toolbar.

      The File Description List for Join dialog box opens.

    6. Select locale.mas and click Open.

      Developer Studio automatically creates a Join between the data sources, if they both have fields with the same formats. The Join tool displays both data sources and, the default Joins, as shown in the following example image.

    7. Close the Join tool to save the Join and update the procedure.

      The Join is added to the Procedure Viewer.

  2. Create the CITY value where clause in the report.
    1. Click a component connector (yellow diamond) and select Report.

      The Open dialog box appears.

    2. Select centurysales.mas and click Open.
    3. Select By from the Columns toolbar and double-click LATITUDE and LONGITUDE from the Object Inspector.

      Note: If fields in your source are not called Latitude, Longitude, or Marker, you can:

      • Use the SET TOOL to Set ASNAMES = ON, to add AS Names in your procedure.
      • In Report Painter, right-click the Field and select Column Title, to type in the correct name.

    4. Select Where/If and click Where.

      The Expression Builder opens.

    5. Create the following expression:
      CITY EQ 'Nashville'

    6. Click Apply.
    7. Select Where/If and click Retrieval Limits.
    8. Enter 1 as the Record Limit.
    9. Select Standard XML (XML) as the Unstyled format.
    10. Click the Output tab and select Web browser from the Destination drop-down list.
    11. Click OK to close the Report Options dialog box.
  3. Save and close the report.

    In this example, Nashville is set as the center value starting point for your report.


WebFOCUS