Language:


Adding a Search - Searching for Objects and Customer Classifications

You can use the standard method described here to provide a search in almost any field. Two exceptions are the Object and Customer Classification fields, because these fields can contain several values separated by commas. For example, a particular Customer might belong to Classifications A, B and C, in which case its Classification field will contain "A,B,C". This Customer should be found when you search for Customers belonging to Classification B, when you search for Customers belonging to Classifications B and C, and so on. The standard search method will not find this Customer, because it is looking for field values that exactly match what is typed in the specification window. It is not capable of finding a field value that is only a partial match: it cannot extract the "B" or the "B,C" from "A,B,C".

If you need to search in an Object or Classification field, follow these steps:

  1. Return to the Report Definition record and go to the 'Data' card.

  2. Click on the line in the report display area marked "Register: Customers..." to specify that the search is to be carried out in the Customer register, and then click the [Selection] button. Complete the 'Selection' dialogue box as described here and illustrated below:

    Instead of using the Field Name field, quote the SetInSet function in the Formula field. SetInSet is a function inside Hansa that finds field values that partially or completely match the search criterion. This function takes two parameters (in the brackets separated by a comma) as follows:

    1. the variable from the specification window (named in the Variable Name field below) containing the search criterion (vsClass in the example); and

    2. the field that is the subject of the search, vrCustomer.Classification in the example. This an expression meaning the Classification field in the Customer register. The expression is in two parts: the first part ("vrCustomer") is the name of the variable containing the Customer register. This name was given to the variable in the 'Register' dialogue box as described on the Specifying the Primary Register page. The second part ("Classification") is the internal name for the Classification field in the Customer register. The two parts are separated by a full stop. The expression "vrCustomer.Classification" therefore means "the Classification field in the Customer register". The expression is case sensitive, so you must use "Classification" and not "classification". You cannot refer directly to the Customer register itself in the expression: you have to refer to it indirectly by using the vrCustomer variable.

    This is the exact call to the SetInSet function in the example:
    SetInSet(vsClass,vrCustomer.Classification)
    Complete the remainder of the 'Selection' dialogue box as described here. In the example, the vsClass variable is placed in the specification window 20 pixels below the existing vsCustNo variable. This vsClass variable together with the call to the SetInSet function enables the person producing the report to search for Customers with a particular Classification or set of Classifications.

    For the person producing the report, there is no apparent difference between vsClass and the other two variables:

You should also use SetInSet in a report that lists Activities in which you want to search for a Person or Cc.