Custom Search Criteria

Modified on Wed, 25 Mar at 11:06 PM

TABLE OF CONTENTS



Search Criteria Windows


Search Criteria windows in Synergetic allow users to search for records based on various criteria.  

image.png 

image.png

 

Sometimes users would like to be able to search based on values that do not appear on the standard Search Criteria windows.  Schools may add custom criteria to the standard search criteria with User Search screens.  These add a [Custom...] button at the bottom of the Search Criteria screen which links to another window to which the School can add their own criteria.


For example, custom criteria in Current Student Maintenance:

image.png

image.png


There are two main steps in doing this:

1)    Design the custom criteria screen

2)    Give the appropriate users permissions to use the custom criteria screens

Limitation: For each maintenance program the organisation may only have one custom search screen.

 


Custom Student Search

image.png 

Schools will want their own set of criteria but the ones in the example here are designed to demonstrate a number of different ways of searching and how to add those to User Search screens.

 

Getting Started

The first steps in setting up a custom user search screen are to identify:

1)    Which maintenance program you will add the custom search criteria to.

2)    Which field uniquely identifies the records in that maintenance program.

In the case of Current Student Maintenance the ID of the student uniquely identifies the records that appear in the Grid Selector:

image.png

We need to know this as when creating the custom criteria we will have to create an SQL statement that returns values of that unique field.

 


Creating a New User Search

To create a new User Search screen select the User/Report Form Editor:

System > User/Report Form Editor

This will show entries for Crystal Reports and User Forms as well as any User Search screens that have been set up.

You can filter the list to show just the User Search screens using the ResourceType:  filter at the top of the Report Selector.

image.png

Do this first as you will not be able to add a new User Search for any maintenance program that already has a User Search screen.  In that case you could add additional criteria to the existing search criteria instead.

Assuming you have no existing User Search for the module STU we can add a new one now.  To do this:

1)    Click on the Insert button at the bottom of the Report Selector window

image.png

2)    Select User Search in the Resource Type area:

image.png

3)    Select Module: STU

image.png

4)    You can also add a description in the Desc field though it is not necessary:

image.png

5)    Click on the Save button on the Report Selector window:

image.png

6)    The next important consideration is to determine which fields you want to search on and where that information can be found in the database.

Consider the custom criteria screen we are creating:

image.png

The fields of interest are:  
 Table:Field Name:
Country of BirthCommunityCountryOfBirthCode
Dietary RequirementCommunityDietaryRequirementCode
Religion (from a drop down)CommunityReligionCode
Religion (searching the description)luReligionDescription
Parish (from a drop down)CommunityParishCode
Parish (searching the description)luParishDescription
Year level >=StudentYearsYearLevel
Year level <=StudentYearsYearLevel

 

The SQL Object field in the Report Selector will require an SQL statement that returns student/community IDs.  It will also have to include the tables which contain the fields we wish to limit the search on.

 image.png

 


Searching by Country of Birth

Country of Birth is found in the Community Table.  Therefore we will need to include it in the SQL statement.


SQL Statement

Click on the [Memo] button next to the SQL Object field and add the following select statement.

image.png

 

Group Box

On the User Form Designer click on [Insert]

This will add a group box and a sample custom criteria:

image.png 

The group box allows us to group thematically related items into one area on the screen.

image.png 

You can change the label and the dimensions of the box in the Additional Properties area.  Change the Width value to 500.

 

Criteria Using a Lookup Table

Select the Sample field row and, down the bottom of the User Form Designer window, change the entry to:

image.png

 

Type: wwDBLookupCombo  This field is going to be a dropdown box populated by values from a lookup table.
Parent:2 This means that this field is contained in the Group Box defined above.
Top Rel: 20  Top Rel determines how far down the window this item will appear in relation to the previous entry.
Left Rel Right: 110  Left Rel Right determines how far across the page this item will appear.  If Top Rel is 0 then the distance is in relation to the previous item.  If this is the first item on a new row then the count starts from the left of the screen.  The value specifies the start of the entry field (edit box or drop down). The label appears to the left of this point so you need to ensure you have left enough space for the label.
Label Caption (to the left): Country of Birth:  This is the label appearing on the left of the drop down
luTable: luCountry Populate the drop down from this lookup table.
Passed to Crystal Reports as: Where
Field Name: COM.CountryOfBirthCode
Field Type: VarChar
         ·     Select Join: AND
         ·     Select Operator: =

 

The cumulative result of these last 5 fields are that the SQL statement will be filtered  with:

WHERE COM.CountryOfBirthCode = <the value selected in the drop down>

Note we have aliased the community table as COM and referred to the field using the table and field name.  At this point it is not strictly necessary.  It will become useful later when we are joining tables where field names may occur in both tables.  

 

Save and Test

Click on [Save] on the User Form Designer Window.  You can then use the [Test] button to see how the selection screen will look.

image.png




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article