Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

...

  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 . This will most likely have been done during your Weave installation. 
     
  4. Also during During your Weave installation, some searches will may 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 a simple search where the input is typed in by the Weave user as shown in the example below.

    Code Block
    <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 search in Weave will appear as shown below:




  7. If you want to have a drop-down list as part of your Search, the controlType XML Attribute of "listbox" needs to be included as shown below. Also the The content of the list is specified by the dataset XML Attribute (which will be created in the next step).

    Code Block
    <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 The above step adds a drop-down list to the Search panel but it the list 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. 

    Code Block
    <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  Tool in the Administration Tool reports on all the valid Data Definitions created so you can use it to find and view the definitions of all the Data Definitions. 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, the values 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 list items displayed in a different order and the number of possible values is small, it may be better to , you can set up this search parameter as a value list. This requires some configuration the configuration of the XML file but it will produce a better result for the Weave user and is a good alternative to an automatic list if the number of possible values is small
     
  12. Add the following code to your search.xml file.

    Code Block
    <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 number of items you'd want to use for this type of list.

    Code Block
    <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:





...

Filter by label (Content by label)
showLabelsfalse
max5
spacescohga
showSpacefalse
sorttitle
typepage
cqllabel in ("layer","select","search","activelayer") and type = "page" and space = "cohgaweavedocs1"
labelssearch activelayer select layer

...