Show / Hide Table of Contents

Class GenericSearch

Obsolete. Use SearchEngine instead.

Represents a generic database search. GenericSearch has less functionality for adding criteria than SearcEngine. The GenericSearch is originally made for searching and fetching data from the database. Thereby its name. GenericSearch is a tool for building up SQL queries, by adding fields and criteria.

GenericSearch extends theSearchEngine class with options for how to list fields. Displayfields, datafields, idfields. The fields must be given as starttablename.fieldname, for example "ticket.title" For tables that have foreign keys to other tables, you can reach them with starttablename.fieldname.fieldname

Make sure that all fields you use start with the same table, for example ticket, or else you will recieve a big join that you probably do not want.

For many-to-many relations there is a special notation: table1.(table2->field2a).field2b Where field2a is field in table2 that has a foreign key to table1.
Syntax
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

Constructors

GenericSearch()

Initializes a new instance of the File class.

Declaration
GenericSearch
Remarks

Obsolete! Use SearchEngine instead.

Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

Methods

addComparison(String,String,String,String,Integer)

Adds a criteria between two database-fields to the database query.

Declaration
Void addComparison(String field1, String compOperator, String field2, String rowOperator, Integer concatLevel)
Parameters
Type Name Description
String field1

The field to compare with field2

String compOperator

Comparison operator. (OperatorEquals, OperatorNotEquals, OperatorLt, OperatorLte, OperatorGt, OperatorGte, OperatorLike, OperatorNotLike, OperatorContains, OperatorBeginsWith, OperatorEndsWith, OperatorIn, OperatorNotIn, OperatorIs, OperatorOracleLeftJoin, OperatorIsNot)

String field2

The field to compare with field1

String rowOperator

Operator for composing this criteria with a following criterion. (OperatorAnd, OperatorOr, OperatorNotAnd, OperatorNotOr)

Integer concatLevel

A number. All criteria with the same number will be placed inside the same brackets.

Returns
Type Description
Void
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

addCriteria(String,String,String,String,Integer)

Add search criteria to the search.

Declaration
Void addCriteria(String field, String operator, String value, String andOr, Integer concatLevel)
Parameters
Type Name Description
String field

The name of the field to select

String operator

The operator for the criteria (OperatorNone, OperatorAnd, OperatorOr, OperatorNotAnd, OperatorNotOr, OperatorLike, OperatorNotLike, OperatorContains, OperatorBeginsWith, OperatorEndsWith, OperatorEquals, OperatorNotEquals, OperatorGt, OperatorLt, OperatorGte, OperatorLte, OperatorIn, OperatorNotIn, OperatorIs, OperatorOracleLeftJoin, OperatorIsNot)

String value

The value to compare with the field

String andOr

The operator which combine this criteria with the following criteria (OperatorAnd, OperatorOr, OperatorNotAnd, OperatorNotOr)

Integer concatLevel

A number to use for combining criteria inside brackets. If the criteria has the same concatLevel, the end up inside the same brackets.

Returns
Type Description
Void
Remarks

The concatLevel specifies how this criteria will be concatenated with the rest of the query (parenthesis level). A higher concatLevel gives a "(", and a lower concatlevel gives a ")".

Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

addField(String,Integer)

Adds a field to the queryAdds a field to be selected to the database query with a field mask.

Declaration
Void addField(String field, Integer fieldMask)
Parameters
Type Name Description
String field

The name of the field to select

Integer fieldMask

See table.

Returns
Type Description
Void
Remarks

fieldMask:

MaskDescription
1ID of the table
2Data value
4Display value
8Search value
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

addOrder(String,Bool)

Adds order on specified field, descending or ascending.

Declaration
Void addOrder(String field, Bool asc)
Parameters
Type Name Description
String field

The field that will be sorted

Bool asc

The direction of the sort. true = ascending; false = descending.

Returns
Type Description
Void
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

countRows()

Returns the number of rows in the result set.

Declaration
Integer countRows()
Returns
Type Description
Integer

The number of rows in the result set.

Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

eof()

Returns true if the result pointer has reached the end of result set, or false otherwise.

Declaration
Bool eof()
Returns
Type Description
Bool

True if the result pointer has reached the end of result set; otherwise, false.

Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

execute()

Executes the query.

Declaration
Void execute()
Returns
Type Description
Void
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

first()

Sets the result pointer to point at the first row in the result set.

Declaration
Bool first()
Returns
Type Description
Bool

False if the result set is empty; otherwise, true.

Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

get(Integer,Integer)

Retrieves the value of a field according to a field mask.

Declaration
String get(Integer id)
Parameters
Type Name Description
Integer id

The ID of the field to select

Integer fieldMask

See table.

Returns
Type Description
String

The value of the field.

Remarks

fieldMask:

MaskDescription
1ID of the table
2Data value
4Display value
8Search value
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

get(String,Integer)

Retrieves the value of a field according to a field mask.

Declaration
String get(String field)
Parameters
Type Name Description
String field

The name of the field to select

Integer fieldMask

See table.

Returns
Type Description
String

The value of the field.

Remarks

fieldMask:

MaskDescription
1ID of the table
2Data value
4Display value
8Search value
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

next()

Sets the result set pointer to next row, returns

Declaration
Bool next()
Returns
Type Description
Bool

True if there is a next row; otherwise, false (the pointer has reached the last result set)

Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

setLanguage(Integer)

Sets what language to use when showing display fields.

Declaration
Void setLanguage(Integer languageId)
Parameters
Type Name Description
Integer languageId

What language to use.

Returns
Type Description
Void
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".

setLimit(Integer)

Sets a limit of the number of rows that will be returned in the result set.

Declaration
Void setLimit(Integer limit)
Parameters
Type Name Description
Integer limit

The maximum number of rows to be returned in the result set.

Returns
Type Description
Void
Examples
ticket.(ticket_customers->ticket_id).cust_id

The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".

The company name of the primary customer of a ticket is "ticket.cust_id.company.name".
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top