Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

When you have made a layer selectable (by defining it as an Active Layer) you can now define a search that will run on that layer. 

Step-by-step guide

  1. Make note of the Active Layer from the Weave client for which you want to define a Search
     
  2. Open your entity.xml and search for the Active Layer name. It will appear as the label in an entity XML Tag. Make note of the value of the id XML Attribute and search for it within the same file. It will appear in a mapping XML Tag. Make a note of the values of the spatialengine, table and key XML Tags. 
     
  3. Ensure the Search panel is visible somewhere in the Weave application by adding the <view id='com.cohga.html.client.main.searchView'> item to the client_main.xml file - this will most likely have been done during your Weave installation. 
     
  4. Also during your Weave installation, some searches will have been configured in the search.xml, or since then, you will have configured some yourself. In order to get the correct structure of the search XML, the easiest thing to do is to copy an existing search:attribute XML Element, and then edit it.

  5. Modify the XML Attribute values so that they reflect your database and the fields you want to search. Keep in mind that databases have different rules regarding the case of field names (PostgreSQL uses lower case, Oracle uses upper case, SQL Server uses mixed case, etc.).
     

  6. Start with an easy search where the input is typed in by the Weave user as shown in the example below.

    <search:attribute id='counciltrees' entity='counciltrees' displayname='Council Trees by Details' datasource='gis' table='mann.counciltrees' key='fid'>
    	<search:parameter id='treenum' promptText='Tree Number' dataType='float' alignment='right' helptext='Type in the tree number' column='tree_no' />
    </search:attribute>


    The resulting list in Weave will appear as shown below:




  7. If you want to have drop-down list as part of your Search, the controlType XML Attribute needs to be included as shown below.

    <search:attribute id='counciltrees' entity='counciltrees' displayname='Council Trees by Details' datasource='gis' table='mann.counciltrees' key='fid'>
    	<search:parameter id='treenum' promptText='Tree Number' dataType='float' alignment='right' helptext='Type in the tree number' column='tree_no' />
    	<search:parameter id='treespecies' label='Species' controlType='listbox' column='species' dataset='specieslist' labelcolumn='label' valuecolumn='value' />
    </search:attribute>
  8. This will add the drop-down list to the Search panel but it won't have any values in it. To populate the list, a Data Definition needs to be created in the data.xml file. The Data Definition specifies which values will be in the list. 

    <data:datadefinition id='specieslist>
    	<datasourcedataconnection datasource='gis' table='counciltrees' prefix='DISTINCT'>
    		<parameter type='string' name='label' label='Label' column='species' />
    		<parameter type='string' name='value' label='Value' column='species' />
    	</datasourcedataconnection>
    </data:datadefinition>	 
  9. You will need to refresh your Weave browser to see the new list appear in the Search panel. 



  10. The Config option in the Administration Tool reports on all the valid Data Definitions created. The Data Definition you created for your drop-down list should be shown, together with others used in Data Grids. Press the Open button to view the XML for it. 
     
  11. In some cases in a list the values may appear in the incorrect order, e.g. they are stored as a string but they are quantitative rather than qualitative, as shown in the example below.


    In order to get the numbers displayed in a different order and the number of possible values is small, it may be better to set up this search parameter as a value list. This requires some configuration the XML file but it will produce a better result for the Weave user. 
     
  12. Add the following code to your search.xml file.

    <search:parameter id="treeheight" label="Height" controlType="listbox" column="height">
    	<list label="0-2m" value="0-2m"/>
    	<list label="2-5m" value="2-5m"/>
    	<list label="5-10m" value="5-10m"/>
    	<list label="10-15m" value="10-15m"/>
    	<list label="15+m" value="15+m"/>
    </search:parameter>


    The resulting list in Weave will appear as shown below:


     

  13. You could also use radio buttons to get the listing in the correct order. This works for a short list and five items is probably the maximum you'd want to use.

    <search:parameter id="treeheight" label="Height" controlType="radiobutton" column="height">
    	<list label="0-2m" value="0-2m"/>
    	<list label="2-5m" value="2-5m"/>
    	<list label="5-10m" value="5-10m"/>
    	<list label="10-15m" value="10-15m"/>
    	<list label="15+m" value="15+m"/>
    </search:parameter>


    The resulting list in Weave will appear as shown below:





Also refer to the following sections of the Weave System Administrator Guides:

Filter by label

There are no items with the selected labels at this time.

  • No labels