public class Fields
extends java.lang.Object
implements java.io.Serializable
Fields
set for the Runtime Designer Component. This class manages all kinds of Field
s, DatabaseFields
, FormulaFields
,
PromptFields
, etc. You can add, get, count and remove each kind of Field
s with this class. SqlExprField
SummaryField
FormulaField
PromptField
new Fields()
. Access with the get*Field
methods included in this class and with method
Engine.getFields()
in class Engine.DatabaseField
,
FormulaField
,
SummaryField
,
PromptField
,
SortField
,
GroupField
,
SQLField
,
SpecialField
,
Serialized FormModifier and Type | Method and Description |
---|---|
FormulaField |
addFormulaField(java.lang.String name,
java.lang.String formula,
int type)
Add a new formula field into the set of formula fields.
|
com.inet.report.formula.userfunctions.UserFunction |
addFunction(java.lang.String name,
java.lang.String formula,
int syntax)
Adds a user function to the report
|
void |
addListener(com.inet.report.RDC.FieldsRefreshListener frl)
All added listeners will get a refresh call if this fields list is changed.
|
PromptField |
addPromptField(java.lang.String name,
java.lang.String text,
int type)
Adds a new prompt field to the set of prompt fields.
|
SQLField |
addSQLField(java.lang.String name,
java.lang.String sqlExpression)
Adds a new sql field to the set of sql fields.
|
SQLField |
addSQLField(java.lang.String name,
int valueType,
java.lang.String sqlExpression,
Datasource datasource)
Adds a new sql field to the set of sql fields.
|
SortField |
addSortField(java.lang.String name,
int type)
Creates a new sort field and adds it to this fields set.
|
SortField |
addSortField(Field field,
int type)
Creates a new sort field and adds it to this fields set.
|
SortField |
addSortField(Field field,
FormulaField formula)
Creates a new sort field and adds it to this fields set.
|
SummaryField |
addSummaryField(Field field,
int operation,
java.lang.String name)
Adds a new summary field into the set of summary fields.
|
SummaryField |
addSummaryField(Field field,
Field field2nd,
int operation,
java.lang.String name)
Adds a new summary field into the set of summary fields.
|
boolean |
checkIfNameExists(int type,
java.lang.String name)
If a field with type
type and name name already exists then true is returned, otherwise false . |
DatabaseField |
getDatabaseField(int idx)
Returns the idx-th element of database fields array.
|
DatabaseField |
getDatabaseField(java.lang.String dbColName)
Returns the DatabaseField with name
dbColName or null if not existent in report. |
int |
getDatabaseFieldsCount()
Returns the number of database fields of this report.
|
FormulaField |
getFormulaField(java.lang.String fieldName)
Returns the FormulaField with name
fieldName or null if not existent in report. |
FormulaField |
getFormulaField(int idx)
Returns the i-th element of Formula Fields array.
|
int |
getFormulaFieldsCount()
Returns the number of user formulas in this report.
|
com.inet.report.formula.userfunctions.UserFunction |
getFunction(int index)
Returns the user defined functions at the specified index
|
com.inet.report.formula.userfunctions.UserFunction |
getFunction(java.lang.String name)
Returns the user defined function with the specified name
|
int |
getFunctionsCount()
Returns the number of user defined functions in this report
|
GroupField |
getGroupNameField(java.lang.String fieldName)
Returns the GroupField with name
fieldName or null if not existent in report. |
GroupField |
getGroupNameField(int idx)
Returns the i-th element of group name fields array.
|
int |
getGroupNameFieldsCount()
Returns the number of group name fields defined in this report.
|
PromptField |
getPromptField(java.lang.String fieldName)
Returns the PromptField with name
fieldName or null if not existent in report. |
PromptField |
getPromptField(int idx)
Returns the i-th element of Prompt Variable Fields array.
|
int |
getPromptFieldsCount()
Returns the number of prompt fields defined for this report.
|
SQLField |
getSQLExpressionField(java.lang.String fieldName)
Returns the SQLField with name
fieldName or null if not existent in report. |
SQLField |
getSQLExpressionField(int idx)
Returns the i-th element of SQL Expression Fields array.
|
int |
getSQLExpressionFieldsCount()
Returns the number of SQL expression fields defined in this report.
|
SortField |
getSortField(java.lang.String fieldName)
Returns the SortField with name
fieldName or null if not existent in report. |
SortField |
getSortField(int idx)
Returns the i-th element of sort fields array.
|
int |
getSortFieldsCount()
Returns the number of the sort fields defined in this report.
|
SpecialField |
getSpecialField(int type)
Returns the special field with the specified operation.
|
int |
getSpecialFieldsCount()
Returns the number of special fields defined in this report.
|
SummaryField |
getSummaryField(java.lang.String fieldName)
Returns the SummaryField with name
fieldName or null if not existent in report. |
SummaryField |
getSummaryField(int idx)
Returns the i-th element of SummaryFields array.
|
int |
getSummaryFieldsCount()
Returns the number of summary fields defined in this report.
|
void |
movePromptField(int from,
int to)
Changes the position of a PromptField by moving it to the specified position.
|
void |
moveSortField(int from,
int to)
Changes the position of a sort field.
|
void |
removeDatabaseField(int idx)
Removes a dataBase field from fields set and all Elements which references to it.
|
boolean |
removeField(Field field)
Removes a specific field.
|
void |
removeFormulaField(int idx)
Removes an existing formula field from set.
|
void |
removeListener(com.inet.report.RDC.FieldsRefreshListener frl)
Remove a previously added listener.
|
void |
removePromptField(int idx)
Removes an existing prompt field from set.
|
void |
removeSQLField(int idx)
Removes an existing sql expression field from report design.
|
void |
removeSortField(int idx)
Removes the sort field specified by the array index from set of sort fields.
|
void |
removeSummaryField(int idx)
Removes an existing summary field from set.
|
public DatabaseField getDatabaseField(int idx) throws ReportException
idx
- The 0-based index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public int getDatabaseFieldsCount()
public void removeDatabaseField(int idx) throws ReportException
idx
- The 0-based array index.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public DatabaseField getDatabaseField(java.lang.String dbColName)
dbColName
or null
if not existent in report.dbColName
- The full name of the database column, i.e. Produkt.Id (alias.column).public FormulaField getFormulaField(java.lang.String fieldName)
fieldName
or null
if not existent in report.fieldName
- The name of the FormulaField to be returned.public SummaryField getSummaryField(java.lang.String fieldName)
fieldName
or null
if not existent in report.fieldName
- The name of the SummaryField to be returned.public GroupField getGroupNameField(java.lang.String fieldName)
fieldName
or null
if not existent in report.fieldName
- The name of the GroupField to be returned.public PromptField getPromptField(java.lang.String fieldName)
fieldName
or null
if not existent in report.fieldName
- The name of the PromptField to be returned.public SQLField getSQLExpressionField(java.lang.String fieldName)
fieldName
or null
if not existent in report.fieldName
- The name of the SQLField to be returned.public FormulaField getFormulaField(int idx) throws ReportException
idx
- The 0-based index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public int getFormulaFieldsCount()
public FormulaField addFormulaField(java.lang.String name, java.lang.String formula, int type)
RDC.MsgListener
interface if the group does not exist when the formula is
checked.name
- The name of the formula field, the name should not null, not empty and not used in another formula already. If the formula is a "user formula" this value must be not null and not empty.formula
- The formula as String, i.e. "if {Kunde.Kunden-ID} mod 2 = 0 then 1 else 0".type
- The type of the formula field specifies the usableness. This can be:
java.lang.IllegalArgumentException
- will be thrown if the type of the formula is "user formula" and the parameter name is null or have a zero lenght, or the formula contains errors.FormulaField.FORMULA_USER
,
FormulaField.FORMULA_PROPERTY
public void removeFormulaField(int idx) throws ReportException
idx
- The 0-based index of the formula field that should removed from set.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public PromptField getPromptField(int idx) throws ReportException
idx
- The 0-based index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public int getPromptFieldsCount()
public void movePromptField(int from, int to) throws ReportException
from
- The current 0-based index of the PromptFieldto
- The new 0-based index of the PromptFieldReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if one of the indexes was less than 0 or greater than size of fields set.public PromptField addPromptField(java.lang.String name, java.lang.String text, int type) throws ReportException
name
- The name of the prompt field (hat to be unique).type
- The value type of the prompt field.text
- The text that asks the user for a value.ReportException
- if value type
is not a legal constant or name
is already in use.Field.NUMBER
,
Field.CURRENCY
,
Field.BOOLEAN
,
Field.DATE
,
Field.TIME
,
Field.DATETIME
,
Field.STRING
,
Field.BINARY
public void removePromptField(int idx) throws ReportException
idx
- The 0-based index of the prompt field that should removed from set.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.PromptField.getDefaultValueProvider()
,
PromptField.setDefaultValueProvider(DynamicValueProvider)
,
CascadingValueProvider
,
FieldValueProvider
public GroupField getGroupNameField(int idx) throws ReportException
idx
- The index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.Group.getGroupNameField()
public int getGroupNameFieldsCount()
public SummaryField getSummaryField(int idx) throws ReportException
idx
- The 0-based index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public int getSummaryFieldsCount()
public SummaryField addSummaryField(Field field, int operation, java.lang.String name) throws ReportException
field
- The field to summarize.operation
- The operation of summarize, i.e. sum, maximum, average.name
- The name of the SummaryField.ReportException
- is thrown if value type does not match.SummaryField.SUM
,
SummaryField.AVERAGE
,
SummaryField.SAMPLE_VARIANCE
,
SummaryField.SAMPLE_STANDARD_DEVIATION
,
SummaryField.MAXIMUM
,
SummaryField.MINIMUM
,
SummaryField.COUNT
,
SummaryField.CORRELATION
,
SummaryField.COVARIANCE
,
SummaryField.WEIGHTED_AVERAGE
,
SummaryField.POP_VARIANCE
,
SummaryField.POP_STANDARD_DEVIATION
,
SummaryField.DISTINCT_COUNT
,
SummaryField.MEDIAN
,
SummaryField.PERCENTILE
,
SummaryField.NTH_LARGEST
,
SummaryField.NTH_SMALLEST
,
SummaryField.MODE
,
SummaryField.NTH_MOST_FREQUENT
,
SummaryField.PERCENTAGE
,
SummaryField.NO_SUMMARY_OPERATION
,
SummaryField.setChangeField(com.inet.report.Field)
,
SummaryField.setResetField(com.inet.report.Field)
public SummaryField addSummaryField(Field field, Field field2nd, int operation, java.lang.String name) throws ReportException
field
- The field to summarize.field2nd
- The second field used by the summary. This field is needed for the summary types SummaryField.CORRELATION
, SummaryField.COVARIANCE
and
SummaryField.WEIGHTED_AVERAGE
.operation
- The operation of summarize, i.e. sum, maximum, average.name
- The name of the SummaryField.ReportException
- is thrown if value type does not match.SummaryField.CORRELATION
,
SummaryField.COVARIANCE
,
SummaryField.WEIGHTED_AVERAGE
,
SummaryField.setChangeField(com.inet.report.Field)
,
SummaryField.setResetField(com.inet.report.Field)
public void removeSummaryField(int idx) throws ReportException
idx
- The 0-based index of the summary field that should removed from set.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public SpecialField getSpecialField(int type)
type
- The type of the SpecialField.java.lang.IndexOutOfBoundsException
- If desired type is invalid.SpecialField.PRINT_DATE
,
SpecialField.PRINT_TIME
,
SpecialField.PRINT_TIME_ZONE
,
SpecialField.MODIFICATION_DATE
,
SpecialField.MODIFICATION_TIME
,
SpecialField.DATA_DATE
,
SpecialField.DATA_TIME
,
SpecialField.DATA_TIME_ZONE
,
SpecialField.RECORD_NUMBER
,
SpecialField.RECORD_COUNT
,
SpecialField.PAGE_NUMBER
,
SpecialField.GROUP_NUMBER
,
SpecialField.TOTAL_PAGE_COUNT
,
SpecialField.REPORT_TITLE
,
SpecialField.REPORT_COMMENTS
,
SpecialField.RECORD_SELECTION_FORMULA
,
SpecialField.GROUP_SELECTION_FORMULA
,
SpecialField.REPORT_FILE
,
SpecialField.REPORT_AUTHOR
,
SpecialField.CREATION_DATE
,
SpecialField.PAGE_N_OF_M
,
SpecialField.HORIZONTAL_PAGE_NUMBER
,
SpecialField.CURRENT_USER_NAME
,
SpecialField.CURRENT_USER_TIME_ZONE
,
SpecialField.CONTENT_LOCALE
,
SpecialField.SELECTION_LOCALE
public int getSpecialFieldsCount()
public SQLField getSQLExpressionField(int idx) throws ReportException
idx
- The 0-based index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public int getSQLExpressionFieldsCount()
public SQLField addSQLField(java.lang.String name, java.lang.String sqlExpression) throws ReportException
name
- A unique name for the sql field to create.sqlExpression
- The sql expression as String.ReportException
- will be thrown if the name already exists or is empty.public SQLField addSQLField(java.lang.String name, int valueType, java.lang.String sqlExpression, Datasource datasource) throws ReportException
name
- A unique name for the sql field to create.valueType
- the type of values, if type unknown it will request the value type from dbsqlExpression
- The sql expression as String.datasource
- The data source to get connection for this sql field.ReportException
- will be thrown if the name already exists or is empty or any problems occurs by checking connection.java.lang.IllegalArgumentException
- if datasource is nullpublic void removeSQLField(int idx) throws ReportException
idx
- The 0-based index of the sql field that should removed from report design.ReportException
- will be thrown if the Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public SortField getSortField(java.lang.String fieldName)
fieldName
or null
if not existent in report.fieldName
- The name of the SummaryField to be returned.public SortField getSortField(int idx) throws ReportException
idx
- The 0-based index of the required field.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public int getSortFieldsCount()
public SortField addSortField(java.lang.String name, int type) throws ReportException
name
- The name of the field that values should be sorted. The name of the field should start with a special character for instanciation:type
- The type of the sort field - ascending or descending.ReportException
- is thrown if value type does not match.SortField.ASCENDING_ORDER
,
SortField.DESCENDING_ORDER
public SortField addSortField(Field field, int type) throws ReportException
field
- The field that values should be sorted.type
- The type of the sort field - ascending or descending.ReportException
- is thrown if value type does not match.java.lang.IllegalArgumentException
- if the field is nullSortField.ASCENDING_ORDER
,
SortField.DESCENDING_ORDER
public SortField addSortField(Field field, FormulaField formula) throws ReportException
field
- The field that values should be sorted.formula
- The type of the sort field defined over formula.ReportException
- will be thrown if value type does not match.SortField.ASCENDING_ORDER
,
SortField.DESCENDING_ORDER
,
SortField.ORIGINAL_ORDER
,
SortField.setSortDirectionFormula(FormulaField)
public void removeSortField(int idx) throws ReportException
idx
- The 0-based array index of the sort field that should be deleted.ReportException
- will be thrown if Engine was invalid or finished.java.lang.IndexOutOfBoundsException
- will be thrown if index was less than 0 or greater than size of fields set.public void moveSortField(int from, int to) throws java.lang.IndexOutOfBoundsException, ReportException
from
- the original 0-based index positionto
- the new 0-based index positionjava.lang.IndexOutOfBoundsException
- if one of the indexes is out of rangeReportException
- will be thrown if Engine was invalid or finished.public boolean checkIfNameExists(int type, java.lang.String name)
type
and name name
already exists then true
is returned, otherwise false
.type
- - the type of the fieldname
- - the name to checkjava.lang.IllegalArgumentException
- If the field type was invalid.Field.getType()
public void addListener(com.inet.report.RDC.FieldsRefreshListener frl)
frl
- An object which implements the RDC.FieldsRefreshListener and should handle the call-back for this fields list.public void removeListener(com.inet.report.RDC.FieldsRefreshListener frl)
frl
- An object which implements the RDC.FieldsRefreshListener interface and should handle the call-back for this fields list.public int getFunctionsCount()
public com.inet.report.formula.userfunctions.UserFunction getFunction(int index)
index
- the index of the functionjava.lang.ArrayIndexOutOfBoundsException
- in case the index does not existpublic com.inet.report.formula.userfunctions.UserFunction getFunction(java.lang.String name)
name
- the name of the functionpublic com.inet.report.formula.userfunctions.UserFunction addFunction(java.lang.String name, java.lang.String formula, int syntax)
name
- the name of the user functionformula
- the function implementation.syntax
- the syntax of the functionUserFunction.remove()
,
UserFunction.rename(String)
,
UserFunction.duplicate(String)
,
FormulaField.SYNTAX_BASIC
,
FormulaField.SYNTAX_CRYSTAL
public boolean removeField(Field field) throws ReportException
field
- The Field instance that shall be removed.ReportException
- The report seems to be invalidated in the mean time.Copyright © 1999-2020 by i-net software GmbH