The example below shows a simplified search definition and indicates how to incorporate scripts and functions. For example, in the <parameters> element, the function MyLookupFunction is included in a search parameter definition; this function allows the user to select a value from a popup or picker window when customizing a search.
Similarly, the <script> element in the <results> section includes three functions necessary to display search results in an Excel view; these functions are ShowExcel(), ResultsComponent() and LoadSpreadsheet().
Note: Notice how the script definition is contained with a CDATA section so that it does not get interpreted as XML.
<?xml version="1.0" encoding="UTF-8"?>
<searches
<search
<parameters>
<parameter_group … />
<parameter_line … />
<parameter … />
<parameter Lookup_function=" MyLookupFunction" />
<script>
<[CDATA[
<script type="text/javascript" src="scripts/search-helper.js">
</script>
<script type="text/javascript">
<!--
function MyLookupFunction(name) { … }
-->
</script>
]]>
</script>
</parameters>
<results>
<column … />
<column … />
<column … />
<tool
function="ShowExcel"
/>
<tool
function="ToolbarDelete"
/>
<script>
<[CDATA[
<script type="text/javascript">
<!--
function ShowExcel() { … }
function ResultsComponent() { … }
function LoadSpreadsheet() { … }
-->
]]>
</script>
</script>
</results>
</search>
</searches>
Libraries of script functions may be accessed by the search definition by including the file containing the functions. In the above example the search-helper.js library has been included. Script libraries need to be accessible to the web server and should be installed into the Web/scripts folder.
The search-helper.js library is installed as part of the product and contains a number of useful helper functions.
Note: The script element must be ended with a closing </script> tag, even though the element is empty. The empty element format, closing the tag using /> will not work correctly, remember this is HTML syntax and is not well-formed XML.
|
Copyright © 2012 CA.
All rights reserved.
|
|