Embedding Custom JavaScript Functions in the ESRIINFO.XML File

You can include custom JavaScript functions in the definition file that will be invoked when a report, map, or identify procedure is selected. This can be very useful for collecting parameter selections to be passed to the procedures.

Note: You must manually edit the esriinfo.xml definition file to implement this technique.

For example:

1- <callback identify="parmcollect" mapinit="" map="parmcollect"
2- reportinit="" report="parmcollect"/>
3- <jsincludes>
4- <file map="true" report="true">
5- <fexinfo>
6- <appinfo>
7- <IBIF_adhocfex>
8- <![CDATA[
9- function parmcollect(obj,url)
10- {
11- //-------------------------------------------------------------
12- // - Custom parameter collection code starts here
13-
14- // - append your name=value parameters to the url object that 
15- // - was passed to the function
16- // - url = url + "PARM1" + "=" + escape(parmValue1) + "&";
17- // - Custom parameter collection code ends here
18- //-------------------------------------------------------------
19- return url;
20- }
21- ]]>
22- </IBIF_adhocfex>
23- </appinfo>
24- </fexinfo>
25- </file>
26- </jsincludes>

Code example notes:

Line

Notes

1

Callback tag - You may specify a JavaScript function name for each of the three different procedure types (report, map, and identify).

The mapinit and reportinit specifies the function to be invoked when either the map viewer or the report viewer is launched. These functions will be invoked before any other processing.

4

File tag - These values specify if the embedded JavaScript functions should be returned to the map viewer and the report viewer. These should be both set equal to true.

5-7

This set of lines must appear before the JavaScript function code.

8

JavaScript function - For each of the functions specified in the callback tag there should be a corresponding function entry.

Each function will receive two parameters. The first is referenced as 'obj' and represents the set of objects that are derived by the parsing of the esriinfo.xml definition file.

Note: It is strongly recommended that no changes be made to this object programmatically. Unpredictable performance may occur.

The second is referenced as 'url' and is the HTTP value that will be used to invoke the procedure. This is the value to which your function will append any additional values.

12

Custom code - Add your custom JavaScript code for the function beginning at this line.

16

URL append - This line is an example of adding a new parameter value to the URL. Each name-value pair that is added will be passed to the FEX as an AMPER variable.

19

Return value - Each function must return the amended URL value to the GIS Adapter to be invoked.

20-25

This set of lines must appear after the JavaScript function code.


WebFOCUS