Versions Compared

Key

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

Search

Pages Documentation

Search pages are the xml XML files that contain database query definitions. To refer to a search page from the code the <searchpage_folder>.<searchpage_filename> is used. 


What does this section cover?

Child pages (Children Display)

...

Name
Description
Value
searchcaptionA title which is display at displayed on the screen.Any
sqltypeThe type of SQL script.SELECT or SELECT DISTINCT
tablesA list of tables to be used in the Joins joins and fields sections.Any table name that exists in the database
joinsA list of elements to join the tables.Join
fieldsThe fields that are used in the select and where clauses.Field Item
wheregroupsA wheregroup groups together where conditions in the search file.Wheregroup
groupbyCollect Collects data across multiple records and group groups the results by one or more fields.Any field name
orderbySort Sorts the query result set based on one or more fields.Order By
classnameThe name of the EJB class containing the EJB method that is called to load the search results.Valid EJB class name
methodnameThe EJB method that is called to load the search results.Valid EJB method name
organisationdatabaseIf set to false the SQL query will run against the ecenter table. If set to true the SQL query will run against the organisation table. The default value is true.true, false

Example

Expand
titleSearch Page using SQL query
Image Added

Image Removed 

Code Block
themeEclipse
languagexml
titleSearch Page
<?xml version="1.0" encoding="UTF-8"?>
<dataset xmlns="http://www.crm.com/xmlschema/dataset.rng">
	<searchcaption>Search Products<<searchcaption>key_serch_products</searchcaption>
	<sqltype>Select</sqltype>
	<tables>
		<table><tablename>PRODUCTS</tablename></table>
		<table><tablename>PRODUCTTYPES</tablename></table>
		<table><tablename>PRODUCTBRANDS</tablename></table>
		<table><tablename>PRODUCTFAMILIES</tablename></table>
	</tables>
	<joins>
		<join>
			<indexorder>1</indexorder>
			<outertable>PRODUCTS</outertable>
			<innertable>PRODUCTTYPES</innertable>
			<jointype>RIGHT</jointype>
			<conditions>
				<conditionitem>
					<outerfield>PRODTYPEID</outerfield>
					<condition>=</condition>
					<innerfield>PRODTYPEID</innerfield>
					<andor>AND</andor>
				</conditionitem>
			</conditions>
		</join>
		<join>
			<indexorder>2</indexorder>
			<outertable>PRODUCTS</outertable>
			<innertable>PRODUCTBRANDS</innertable>
			<jointype>LEFT</jointype>
			<conditions>
				<conditionitem>
					<outerfield>PRODBRANDID</outerfield>
					<condition>=</condition>
					<innerfield>PRODBRANDID</innerfield>
					<andor>AND</andor>
				</conditionitem>
			</conditions>
		</join>
		<join>
			<indexorder>3</indexorder>
			<outertable>PRODUCTS</outertable>
			<innertable>PRODUCTFAMILIES</innertable>
			<jointype>LEFT</jointype>
			<conditions>
				<conditionitem>
					<outerfield>PRODFAMILYID</outerfield>
					<condition>=</condition>
					<innerfield>PRODFAMILYID</innerfield>
					<andor>AND</andor>
				</conditionitem>
			</conditions>
		</join>
	</joins>
	<fields>
		<fielditem>
			<field>PRODUCTS.PRODID</field>
			<expression>VALUE</expression>
			<datatype>ftXString</datatype>
			<fieldlen>32</fieldlen>
			<searchcriteria>0</searchcriteria>
			<visible>0</visible>
			<executable>1</executable>
			<indexorder>1</indexorder>
		</fielditem>
		<fielditem>
			<field>PRODUCTS.PRODCODE</field>
			<label>Product Code<<label>key_product_code</label>
			<expression>VALUE</expression>
			<datatype>ftXString</datatype>
			<fieldlen>32</fieldlen>
			<searchcriteria>1</searchcriteria>
			<visible>1</visible>
			<executable>1</executable>
			<indexorder>2</indexorder>
		</fielditem>
		...
	</fields>
	<wheregroups>
		<wheregroup>
			<wherefields>
				<wherefield>
					<field>PRODUCTS.PRODDELETED</field>
					<alias>Expr001</alias>
					<expression>VALUE</expression>
				</wherefield>
				<wherefield>
					<field>0</field>
					<alias>Expr002</alias>
					<expression>VALUE</expression>
				</wherefield>
			</wherefields>
			<wheremembers>
				<wheremember>
					<lparenth>0</lparenth>
					<lfield>PRODUCTS.PRODDELETED</lfield>
					<expression>=</expression>
					<rfield>0</rfield>
					<rparenth>0</rparenth>
					<andor>AND</andor>
				</wheremember>
			</wheremembers>
		</wheregroup>
	</wheregroups>
	<groupby/>
	<orderby/>
</dataset>
Expand
titleSearch Page using EJB method
Image Added

 

Code Block
themeEclipse
languagexml
titleSearch Page
<?xml version="1.0" encoding="UTF-8"?><dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/search.xsd">
	<searchcaption>key_priority_level</searchcaption>
	<classname>ejb/CRMUIServiceRequest</classname>
	<methodname>getPriorityLevels</methodname>
	
	<fields>
	
		<fielditem>
			<field>priorityLevelId</field>
			<expression>VALUE</expression>
			<datatype>ftXString</datatype>
			<fieldlen>32</fieldlen>
			<searchcriteria>0</searchcriteria>
			<visible>0</visible>
			<executable>1</executable>
			<indexorder>10</indexorder>
		</fielditem>
		<fielditem>
			<field>priorityLevelName</field>
			<label>key_priority_level</label>
			<expression>VALUE</expression>
			<datatype>ftXString</datatype>
			<fieldlen>32</fieldlen>
			<searchcriteria>1</searchcriteria>
			<visible>1</visible>
			<executable>1</executable>
			<indexorder>20</indexorder>
		</fielditem>
	</fields>
</dataset>
Code Block
themeEclipse
languagejava
titleEJB method
    /**
	 * Loads a list of service request priority levels filter with the input parameter
	 * 
	 * @param filter  - the filter to filter out the service request priority levels does not match
	 * @return            the list of service request priority levels
	 * @throws Exception
	 */
	public ArrayList<ServiceRequestPriotityLevel> getPriorityLevels(String filter) throws Exception {
		
		
		ArrayList<ServiceRequestPriotityLevel> priorityLevels = new ArrayList<ServiceRequestPriotityLevel>();
		CRMDOServiceRequestDefinition serviceRequestDefinition = (CRMDOServiceRequestDefinition)serviceRequestDefinitionBean.loadActiveDefinition();
		ArrayList<CRMDO> definitionPriorities = serviceRequestDefinitionPriorityBean.load(serviceRequestDefinition);
		if (filter!=null)
		{
			filter = filter.replace("%", "");
			filter = filter.replace("_", "");
		}
		if (definitionPriorities!=null && definitionPriorities.size() > 0)
		{
			for (int i=0; i<definitionPriorities.size(); i++)
			{
				CRMDOServiceRequestDefinitionPriority definitionPriority = (CRMDOServiceRequestDefinitionPriority)definitionPriorities.get(i);
				if(definitionPriority.getLabel()!=null)
				{	
					if (filter==null || filter.length() ==0 || definitionPriority.getLabel().toUpperCase().contains(filter.toUpperCase()))
					{
						ServiceRequestPriotityLevel serviceRequestPriotityLevel = new ServiceRequestPriotityLevel();
						serviceRequestPriotityLevel.setPriorityLevelId(definitionPriority.getPriorityCode());
						serviceRequestPriotityLevel.setPriorityLevelName(definitionPriority.getLabel());
						priorityLevels.add(serviceRequestPriotityLevel);
					}
				}
				else
				{	
					if (filter==null || filter.length() ==0 || definitionPriority.getPriorityCode().toString().toUpperCase().contains(filter.toUpperCase()))
					{
						ServiceRequestPriotityLevel serviceRequestPriotityLevel = new ServiceRequestPriotityLevel();
						serviceRequestPriotityLevel.setPriorityLevelId(definitionPriority.getPriorityCode());
						serviceRequestPriotityLevel.setPriorityLevelName(definitionPriority.getPriorityCode().toString());
						priorityLevels.add(serviceRequestPriotityLevel);
					}
				}
			}
		}
		
		return priorityLevels;
	}
Code Block
themeEclipse
languagejava
titleSearch results Data Object
public class ServiceRequestPriotityLevel extends NotPersistenceObject {
	private static final long serialVersionUID = 1L;
	
	private Integer priorityLevelId;
	private String priorityLevelName;
	
	public Integer getPriorityLevelId() {
		return priorityLevelId;
	}
	public void setPriorityLevelId(Integer priorityLevelId) {
		this.priorityLevelId = priorityLevelId;
	}
	public String getPriorityLevelName() {
		return priorityLevelName;
	}
	public void setPriorityLevelName(String priorityLevelName) {
		this.priorityLevelName = priorityLevelName;
	}
}