Creating and Modifying a Query
This topic introduces how to create and modify a query in a catalog.
Below is a list of the sections covered in this topic:
Inserting a Query into a Catalog
The following methods are used to insert a query into a catalog and to return the handle of the newly inserted query:
- insert(String qryName, QueryFieldInfo queryFieldInfo,QueryJoinInfo queryJoinInfo, QueryQBEInfo queryQBEInfo, QueryAndInfo queryAndInfo)
- insert(String dataSourceName, String qryName, QueryFieldInfo queryFieldInfo, QueryJoinInfo queryJoinInfo, QueryQBEInfo queryQBEInfo, QueryAndInfo queryAndInfo)
Parameters
- qryName - The query name.
- queryFieldInfo - The table and fields information.
- queryJoinInfo - The join information.
- queryQBEInfo - The QBE information.
- queryAndInfo - The where condition information.
Reference: For details about the classes QueryFieldInfo, QueryJoinInfo, QueryQBEInfo and QueryAndInfo, refer to the Logi JReport Javadoc jet.api package in <install_root>\help\api
, which includes all the documents generated by Javadoc.
Adding or Deleting Tables in a Query
- set(String dataSourceName, String qryName, String tablename, String columnname, boolean isFormula)
Adds a new table to a query and returns a Boolean value: true if successful, otherwise false. - deleteQueryTable(String dataSourceName, String qryName, String tablename)
Deletes the selected table in a query and returns a Boolean value: true if successful, otherwise false.
Note: The tables that are to be added should exist in the specified catalog.
Parameters
- qryName - The query name.
- tablename - The name of the table that is to be inserted or deleted.
- selectAllFields - Specifies whether or not to insert a table with all its fields.
Adding or Deleting Fields in a Query
- set(String dataSourceName, String qryName, String tablename, String columnname, boolean isFormula)
Adds a new field to a query and returns a Boolean value: true if successful, otherwise false. - deleteQueryField(String dataSourceName, String qryName, String tablename, String columnname)
Deletes the selected fields in a query and returns a Boolean value: true if successful, otherwise false.
Parameters
- qryName - The query name.
- tablename - The table name of the inserted or deleted field.
- isFormula - Indicates whether the inserted field is a formula.
- columnname - The column name of the deleted field.
Adding or Deleting Joins in a Query
- set(String dataSourceName, String qryName, String tableFrom, String columnFrom, String operator, String tableTo, String columnTo, boolean isSQL92, int outerJoin)
Adds a new join to a query and returns a Boolean value: true if successful, otherwise false. - deleteQueryJoin(String dataSourceName, String qryName, String tableFrom, String columnFrom, String operator, String tableTo, String columnTo)
Deletes joins in a query and returns a Boolean value: true if successful, otherwise false.
Parameters
- qryName - The query name.
- tableFrom - The name of the table from which the join links.
- columFrom - The name of the column from which the join links.
- tableTo - The name of the table to which the join links.
- columnTo - The name of the column to which the join links.
- operator - Operator of the join to be inserted or deleted.
Adding or Deleting QBE Conditions in a Query
- setQBE(String dataSourceName, String qryName, String tablename, String columnname, String expression)
Adds a new QBE condition to a query and returns a Boolean value: true if successful, otherwise false. - deleteQBE(String dataSourceName, String qryName, String tablename, String columnname, String expression)
Deletes the QBE condition in a query and returns a Boolean value: true if successful, otherwise false.
Parameters
- qryName - The query name.
- tablename - The name of the table where the QBE condition will be added or deleted.
- columnname - The name of the column where the QBE condition will be added or deleted.
- expression - The expression of the QBE condition.
Adding or Deleting where Conditions in a Query
- setCondition(String dataSourceName, String qryName, String sExpression1, String sOperator, String sExpression2, String sLogic)
Adds a new where condition to a query and returns a Boolean value: true if successful, otherwise false. - deleteCondition(String dataSourceName, String qryName, String sExpression1, String sOperator, String sExpression2, String sLogic)
Deletes the where conditions in a query and returns a Boolean value: true if successful, otherwise false.
Parameters
- qryName - The query handle.
- sLogic - The logic string of the where condition that is to be inserted or deleted.
- sExpression1 - The first expression of the where condition that is to be inserted or deleted.
- sOperator - The operator of the where condition that is to be inserted or deleted.
- sExpression2 - The second expression of the where condition that is to be inserted or deleted.