Package com.inet.report
Class FormulaField
- java.lang.Object
-
- com.inet.report.Field
-
- com.inet.report.FormulaField
-
- All Implemented Interfaces:
com.inet.report.formula.IFormulaData
,NodeParser
,com.inet.report.ReferencedObject
,com.inet.report.ReferenceHolder
,Validatable
,java.io.Serializable
public class FormulaField extends Field implements com.inet.report.ReferenceHolder, Validatable, com.inet.report.formula.IFormulaData
This class represents a field, which value is calculated by a formula. The formula have to be in Crystal Reports formula syntax or if you set 'basicFmSyntax' to true in basic syntax. To add aFormulaField
to the fields set use methodFields.addFormulaField(String,String,int)
in classFields
. Note that the usableness of the formula field have to set explicitly at creation time or with methodsetFormulaType(int)
.
This class is part of the RDC.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inet.report.Field
Field.FieldAttributeTag
-
-
Field Summary
Fields Modifier and Type Field Description static int
BEFORE_READING_RECORDS
Constant value of evaluation time.static int
FORMULA_GROUP_SELECTION
group selection formulastatic int
FORMULA_PROPERTY
property formulastatic int
FORMULA_RECORD_SELECTION
record selection formulastatic int
FORMULA_USER
user defined formulaint
loopCount
Deprecated.as of i-net Clear Reports 14static int
SYNTAX_BASIC
Formula in Basic Syntaxstatic int
SYNTAX_CRYSTAL
Formula in Crystal Syntaxstatic int
TREAT_NULL_AS_NULL
Sets the formula calculation to tolerate null values, if possible.static int
TREAT_NULL_BY_DEFAULT
Sets the formula calculation to replace null values by the default values of the same type.static int
TREAT_NULL_BY_EXCEPTION
Sets the formula calculation to always interrupt if there is any null value.static int
UNSPECIFIED_EVALUATE_TIME
Constant value of evaluation time.static int
WHILE_PRINTING_RECORDS
Constant value of evaluation time.static int
WHILE_READING_RECORDS
Constant value of evaluation time.-
Fields inherited from class com.inet.report.Field
BINARY, BOOLEAN, CURRENCY, CURSOR, DATABASE_FIELD, DATE, DATETIME, FORMULA_FIELD, GROUP_NAME_FIELD, NUMBER, PARAMETER_FIELD, SORT_FIELD, SPECIAL_FIELD, SQL_FIELD, STRING, SUMMARY_FIELD, TIME, UNKNOWN
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLYvoid
checkContext()
Checks the evaluation time of the current formulaint
checkFormula(java.lang.String formula, boolean basic, int nullBehavior)
Checks a formula as if it was set to to this formula fields.static int
checkFormula(java.lang.String formula, boolean basic, Engine engine)
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.static int
checkFormula(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute)
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.static int
checkFormula(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute, int formulaType)
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.static int
checkFormula(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute, int formulaType, int nullBehavior)
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.void
clearLocalVariables()
Resets the local variables of this fieldField
duplicate(java.lang.String name)
Duplicates this field with all its settings and returns the created Field with the given name.Field
getCurrentField()
This field references the current report field, which contains this formula.ReportComponent
getElementOfPropertyFormula()
FOR INTERNAL USE ONLY Returns the element which is the owner of this formula if this formula is a property formula.int
getEvaluateTime()
Returns the lowest theoretically possible evaluation time this formula can have.int
getEvaluateTimeReal()
Returns the time of evaluation of this formula that is actually used at runtime.java.lang.String
getFormula()
Returns the value of the property 'formula text'.com.inet.report.formula.Evaluable
getFormulaTree()
FOR INTERNAL USE ONLYint
getFormulaType()
Returns the formula type, i.e. whether the formula is a record selection, group selection, property, or user formulacom.inet.report.formula.Variables
getLocalVariables()
Returns all local variables of this fieldint
getNullBehavior()
Returns the null behavoir constant which was set for this formula field.int
getRealReferencedObjectCount()
FOR INTERNAL USE ONLYint
getReferencedObjectCount()
FOR INTERNAL USE ONLYcom.inet.report.ReferencedObject[]
getReferencedObjects()
FOR INTERNAL USE ONLYint
getSyntax()
Returns the syntax for this formula.java.util.Set<java.lang.String>
getTranslationKeys()
Returns a set of all translation keys used in the formula described by this field.
NOTE: This will re-parse the formula, which costs time and memory!int
getValueType()
Returns the value type (or return type) of the field.
NOTE:If DefaultAttribute is used within the formula it has to be set before calling this method.boolean
isEmpty()
Checks the syntax of the formula and returnstrue
if the formula (body without layout) is empty.static boolean
isEmpty(java.lang.String formula, boolean basic, Engine engine)
Checks the syntax of the formula and returnstrue
if the formula (body without layout) is empty.static boolean
isEmpty(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute)
Checks the syntax of the formula and returnstrue
if the formula (body without layout) is empty.boolean
isOptimized()
FOR INTERNAL USE ONLYboolean
isUsed()
FOR INTERNAL USE ONLYjava.lang.String
paramString()
Returns a prettified output of this field's name and type.NodeParser
parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseEndElement(com.inet.report.parser.XMLTag group, java.lang.String tag, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseText(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
removeReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLYvoid
rename(java.lang.String newName)
FOR INTERNAL USE ONLYvoid
resetReferences()
FOR INTERNAL USE ONLYprotected void
saveFieldXML2(java.io.PrintWriter pw, int depth)
FOR INTERNAL USE ONLY Saves this field in XML formatvoid
setCurrentField(Field currentField)
This field references the current report field, which contains this formula.void
setFormula(java.lang.String formula)
Sets formula text to this element and parses the formula.void
setFormulaTree(com.inet.report.formula.Evaluable tree)
FOR INTERNAL USE ONLYvoid
setFormulaType(int type)
Sets the formula type.void
setName(java.lang.String name)
Sets the name of the formula field.void
setNullBehavior(int nullBehavior)
Sets the null behavoir constant.void
setOptimized()
FOR INTERNAL USE ONLYvoid
setReferences()
FOR INTERNAL USE ONLYvoid
setSyntax(int syntax)
Set the syntax for this formula.com.inet.report.formula.ToSQLResult
toSql(com.inet.report.database.sql.SqlSyntax syntax, com.inet.report.formula.FieldFilter filter, boolean useDesignMode)
FOR INTERNAL USE ONLY Converts the content of this formula to an SQL statement.boolean
usesSummaryFields()
Returns true, if this formula field references to a summary field and is referenced by a summary field - either directly or indirectlyValidity
validate()
Check if the object is valid and returns the state and details of possible errors.-
Methods inherited from class com.inet.report.Field
addReferenceHolder, checkNameExists, equals, extractReference, getField, getGroup, getName, getPlaceholderName, getRealReferenceCount, getReferenceHolderCount, getReferenceHolders, getRefName, getType, indexOf, isDOMParser, parseDOM, removeReferenceHolder, setField, setGroup, setValueType, trimAwayBrackets
-
-
-
-
Field Detail
-
FORMULA_USER
public static final int FORMULA_USER
user defined formula- See Also:
- Constant Field Values
-
FORMULA_RECORD_SELECTION
public static final int FORMULA_RECORD_SELECTION
record selection formula- See Also:
- Constant Field Values
-
FORMULA_GROUP_SELECTION
public static final int FORMULA_GROUP_SELECTION
group selection formula- See Also:
- Constant Field Values
-
FORMULA_PROPERTY
public static final int FORMULA_PROPERTY
property formula- See Also:
- Constant Field Values
-
TREAT_NULL_AS_NULL
public static final int TREAT_NULL_AS_NULL
Sets the formula calculation to tolerate null values, if possible. This is the default i-net Clear Reports behavior.- See Also:
- Constant Field Values
-
TREAT_NULL_BY_DEFAULT
public static final int TREAT_NULL_BY_DEFAULT
Sets the formula calculation to replace null values by the default values of the same type. If there is no default value for a type, an exception will be thrown an the calculation will be interrupted.- See Also:
- Constant Field Values
-
TREAT_NULL_BY_EXCEPTION
public static final int TREAT_NULL_BY_EXCEPTION
Sets the formula calculation to always interrupt if there is any null value.- See Also:
- Constant Field Values
-
UNSPECIFIED_EVALUATE_TIME
public static final int UNSPECIFIED_EVALUATE_TIME
Constant value of evaluation time. The evaluate time was not specified by the user.- See Also:
- Constant Field Values
-
BEFORE_READING_RECORDS
public static final int BEFORE_READING_RECORDS
Constant value of evaluation time. The formula will be evaluated before records from database were read.- See Also:
- Constant Field Values
-
WHILE_READING_RECORDS
public static final int WHILE_READING_RECORDS
Constant value of evaluation time. The formula will be evaluated after records from database were read.- See Also:
- Constant Field Values
-
WHILE_PRINTING_RECORDS
public static final int WHILE_PRINTING_RECORDS
Constant value of evaluation time. The formula will be evaluated while records are printed.- See Also:
- Constant Field Values
-
SYNTAX_CRYSTAL
public static final int SYNTAX_CRYSTAL
Formula in Crystal Syntax- See Also:
- Constant Field Values
-
SYNTAX_BASIC
public static final int SYNTAX_BASIC
Formula in Basic Syntax- See Also:
- Constant Field Values
-
loopCount
@Deprecated public int loopCount
Deprecated.as of i-net Clear Reports 14FOR INTERNAL USE ONLY
-
-
Method Detail
-
getElementOfPropertyFormula
public ReportComponent getElementOfPropertyFormula()
FOR INTERNAL USE ONLY Returns the element which is the owner of this formula if this formula is a property formula.- Returns:
- If this formula is a property formula the element will be returned
otherwise
null
- Since:
- 6.1
-
rename
public void rename(java.lang.String newName) throws ReportException
FOR INTERNAL USE ONLY- Overrides:
rename
in classField
- Throws:
ReportException
-
setName
public void setName(java.lang.String name)
Sets the name of the formula field. The name does not exists already, otherwise an exception will be thrown.
-
getFormula
public java.lang.String getFormula()
Returns the value of the property 'formula text'. The formula text is the expression of the formula. Use crystal syntax or basic syntax. If you want to specify the formula text in basic syntax, you have to set the property 'basic syntax' to true.- Specified by:
getFormula
in interfacecom.inet.report.formula.IFormulaData
- Returns:
- The value of the property 'formula text'.
- Since:
- 6.0
- See Also:
setSyntax(int)
-
setFormula
public void setFormula(java.lang.String formula)
Sets formula text to this element and parses the formula. The formula text can be specified either in crystal or in basic syntax. Please set the syntax type by callingsetSyntax(int)
before calling this function.- Specified by:
setFormula
in interfacecom.inet.report.formula.IFormulaData
- Parameters:
formula
- the new formula- Since:
- 6.0
- See Also:
setSyntax(int)
,getSyntax()
,getFormula()
-
getSyntax
public int getSyntax()
Returns the syntax for this formula. The two supported syntaxes are Crystal or Basic Syntax.- Specified by:
getSyntax
in interfacecom.inet.report.formula.IFormulaData
- Returns:
- the syntax used by this formula
- Since:
- 6.0
- See Also:
SYNTAX_CRYSTAL
,SYNTAX_BASIC
-
setSyntax
public void setSyntax(int syntax)
Set the syntax for this formula. The two supported syntaxes are Crystal or Basic Syntax.- Specified by:
setSyntax
in interfacecom.inet.report.formula.IFormulaData
- Parameters:
syntax
- the syntax to use for this formula- Throws:
java.lang.IllegalArgumentException
- If the syntax is not one of the valid types.- Since:
- 6.0
- See Also:
SYNTAX_CRYSTAL
,SYNTAX_BASIC
-
getFormulaType
public int getFormulaType()
Returns the formula type, i.e. whether the formula is a record selection, group selection, property, or user formula- Returns:
- Type of this formula: A record selection, group selection, property, or user formula
- Since:
- 6.0
- See Also:
FORMULA_USER
,FORMULA_RECORD_SELECTION
,FORMULA_GROUP_SELECTION
,FORMULA_PROPERTY
-
setFormulaType
public void setFormulaType(int type)
Sets the formula type. If the formula is used as a record selection formula then the type is FORMULA_RECORD_SELECTION. If the formula is used as a group selection formula then the type is FORMULA_GROUP_SELECTION. If the formula is used as a property formula then the type is FORMULA_PROPERTY. Otherwise the type is FORMULA_USER.- Parameters:
type
- The type of the formula.- Throws:
java.lang.IllegalArgumentException
- is thrown iftype
is not one of FORMULA_USER, FORMULA_RECORD_SELECTION, FORMULA_GROUP_SELECTION and FORMULA_PROPERTY.- Since:
- 6.0
- See Also:
FORMULA_USER
,FORMULA_RECORD_SELECTION
,FORMULA_GROUP_SELECTION
,FORMULA_PROPERTY
-
checkFormula
public static int checkFormula(java.lang.String formula, boolean basic, Engine engine) throws ReportException
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.- Parameters:
formula
- The formula as stringbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
engine
- The engine that should evaluate the formula- Returns:
- the return type of the formula if syntax and type are correct, else -1 is returned.
- Throws:
ReportException
- will thrown if the syntax or the type of the formula or its expressions and statements is not correct.- Since:
- 6.0
-
checkFormula
public static int checkFormula(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute) throws ReportException
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.- Parameters:
formula
- The formula as stringbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
engine
- The engine that should evaluate the formulacurrentField
- If checked formula is a formula which calculates the property value of a field element then it is possible to use the value of the field in your formula. Therefore use constant "currentFieldValue" informula
. The field of the field element is needed to get the value from.defaultAttribute
- When processing formula which calculates the property value of an element in report, then it is possible to use the constant value of the property in your formulas. Therefore the current value of the property is needed as default attribute.- Returns:
- the return type of the formula if syntax and type are correct, else -1 is returned.
- Throws:
ReportException
- will thrown if the syntax or the type of the formula or its expressions and statements is not correct.- Since:
- 6.0
-
checkFormula
public static int checkFormula(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute, int formulaType) throws ReportException
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.- Parameters:
formula
- The formula as stringbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
engine
- The engine that should evaluate the formulacurrentField
- If checked formula is a formula which calculates the property value of a field element then it is possible to use the value of the field in your formula. Therefore use constant "currentFieldValue" informula
. The field of the field element is needed to get the value from.defaultAttribute
- When processing formula which calculates the property value of an element in report, then it is possible to use the constant value of the property in your formulas. Therefore the current value of the property is needed as default attribute.formulaType
- The formula's type: FORMULA_USER, FORMULA_RECORD_SELECTION, FORMULA_GROUP_SELECTION, or FORMULA_PROPERTY- Returns:
- the return type of the formula if syntax and type are correct, else -1 is returned.
- Throws:
ReportException
- will thrown if the syntax or the type of the formula or its expressions and statements is not correct.- Since:
- 6.0
-
checkFormula
public static int checkFormula(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute, int formulaType, int nullBehavior) throws ReportException
Checks the syntax and the type of the formula and returns the return type of the formula if formula has no errors.- Parameters:
formula
- The formula as stringbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
engine
- The engine that should evaluate the formulacurrentField
- If checked formula is a formula which calculates the property value of a field element then it is possible to use the value of the field in your formula. Therefore use constant "currentFieldValue" informula
. The field of the field element is needed to get the value from.defaultAttribute
- When processing formula which calculates the property value of an element in report, then it is possible to use the constant value of the property in your formulas. Therefore the current value of the property is needed as default attribute.formulaType
- The formula's type: FORMULA_USER, FORMULA_RECORD_SELECTION, FORMULA_GROUP_SELECTION, or FORMULA_PROPERTYnullBehavior
- The null behavior constant:TREAT_NULL_AS_NULL
,TREAT_NULL_BY_DEFAULT
,TREAT_NULL_BY_EXCEPTION
- Returns:
- the return type of the formula if syntax and type are correct, else -1 is returned.
- Throws:
ReportException
- will thrown if the syntax or the type of the formula or its expressions and statements is not correct.- Since:
- 9.0
-
checkFormula
public int checkFormula(java.lang.String formula, boolean basic, int nullBehavior) throws ReportException
Checks a formula as if it was set to to this formula fields. If you're unsure, whether modifying the formula of this field would be corrct, call this function before calling setFormula.- Parameters:
formula
- the formula to checkbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
nullBehavior
- The null behavior constant:TREAT_NULL_AS_NULL
,TREAT_NULL_BY_DEFAULT
,TREAT_NULL_BY_EXCEPTION
- Returns:
- the resulting value type of the formula
- Throws:
ReportException
- thrown if the formula causes any error- Since:
- 10.0
-
getValueType
public int getValueType()
Returns the value type (or return type) of the field.
NOTE:If DefaultAttribute is used within the formula it has to be set before calling this method. A null-value will cause an exception here. If you don't know the exact value of the DefaultAttribute you may use a dummy-value for getValueType. The reason is that getValueType only regards the type of object not their value.- Overrides:
getValueType
in classField
- Returns:
- The value of the property 'value type'.
- See Also:
Field.NUMBER
,Field.CURRENCY
,Field.BOOLEAN
,Field.DATE
,Field.TIME
,Field.STRING
,Field.DATETIME
-
checkContext
public void checkContext() throws ReportException
Checks the evaluation time of the current formula- Throws:
ReportException
- will be thrown if the formula cannot be executed at the requested time- Since:
- 9.0
-
isEmpty
public static boolean isEmpty(java.lang.String formula, boolean basic, Engine engine) throws ReportException
Checks the syntax of the formula and returnstrue
if the formula (body without layout) is empty.- Parameters:
formula
- The formula as stringbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
engine
- The engine that should evaluate the formula- Returns:
true
if formula is empty (except layout like blanks, line feeds, comments) elsefalse
- Throws:
ReportException
- will thrown if the syntax or the type of the formula or its expressions and statements is not correct.- Since:
- 6.0
-
isEmpty
public boolean isEmpty()
Checks the syntax of the formula and returnstrue
if the formula (body without layout) is empty.- Returns:
true
if formula is empty (except layout like blanks, line feeds, comments) elsefalse
- Since:
- 6.0
-
isEmpty
public static boolean isEmpty(java.lang.String formula, boolean basic, Engine engine, Field currentField, java.lang.Object defaultAttribute) throws ReportException
Checks the syntax of the formula and returnstrue
if the formula (body without layout) is empty.- Parameters:
formula
- The formula as stringbasic
-true
if formula has basic syntax, else if formula has crystal syntaxfalse
engine
- The engine that should evaluate the formulacurrentField
- Field to be viewed as the "currentField" of the report, specifically for the "CurrentField" function.defaultAttribute
- Attribute to be viewed as the "defaultAttribute", specifically for the "DefaultAttribute" function.- Returns:
true
if formula is empty (except layout like blanks, line feeds, comments) elsefalse
- Throws:
ReportException
- will thrown if the syntax or the type of the formula or its expressions and statements is not correct.- Since:
- 6.0
-
paramString
public java.lang.String paramString()
Returns a prettified output of this field's name and type.- Overrides:
paramString
in classField
- Returns:
- Prettified output of this field's name and type.
-
toSql
public com.inet.report.formula.ToSQLResult toSql(com.inet.report.database.sql.SqlSyntax syntax, com.inet.report.formula.FieldFilter filter, boolean useDesignMode) throws ReportException
FOR INTERNAL USE ONLY Converts the content of this formula to an SQL statement. The result will only contain the convertable part. The non-convertible part will remain in the AST of this field.- Parameters:
syntax
- the SQL conversion syntax to be used. This depends on the database where the SQL is to be executed. Must not benull
filter
- the filter for the tables which are present on the target database. This is especially relevant if several datasources are used in one report. Ifnull
, all fields are alloweduseDesignMode
- if set to false, the SQL will optimized with the assumption that all referenced fields have their final value. This may lead to wrong results or exceptions in case any value yet undefined. If set to true, all undefined values (e.G. Prompts) will be optimized and the parts of the formula which will be final at runtime will be marked as such.- Returns:
- the conversion result, may be null if the formula is empty
- Throws:
ReportException
- in case the formula is completely not executable in this database- Since:
- 6.0
-
saveFieldXML2
protected void saveFieldXML2(java.io.PrintWriter pw, int depth)
FOR INTERNAL USE ONLY Saves this field in XML format- Specified by:
saveFieldXML2
in classField
- Parameters:
pw
- the writer to write todepth
- the XML indentication depth
-
getEvaluateTimeReal
public int getEvaluateTimeReal() throws ReportException
Returns the time of evaluation of this formula that is actually used at runtime. The difference to the method getEvaluateTime is that formulas will not return as WHILE_READING_RECORDS unless explicitly requested. Rather they will be optimized to "WHILE_PRINTING_RECORDS" in order to reduce the amount of memory needed. This reflects the actual optimization done at run time.- Returns:
- Time of evaluation of the formula actually used at runtime.
BEFORE_READING_RECORDS
,WHILE_PRINTING_RECORDS
, orWHILE_READING_RECORDS
. - Throws:
ReportException
- If parsing the formula encounters errors.- Since:
- 6.0
- See Also:
BEFORE_READING_RECORDS
,WHILE_READING_RECORDS
,WHILE_PRINTING_RECORDS
,getEvaluateTime()
-
getEvaluateTime
public int getEvaluateTime() throws ReportException
Returns the lowest theoretically possible evaluation time this formula can have. At run time, this may be optimized to be a higher evaluation time to save memory. getEvaluateTimeReal returns the evaluation time which is actually used at run time.- Returns:
- Lowest theoretically possible time of evaluation for this formula.
BEFORE_READING_RECORDS
,WHILE_PRINTING_RECORDS
, orWHILE_READING_RECORDS
. - Throws:
ReportException
- If parsing the formula causes any errors- Since:
- 6.0
- See Also:
BEFORE_READING_RECORDS
,WHILE_READING_RECORDS
,WHILE_PRINTING_RECORDS
,getEvaluateTimeReal(boolean)
-
addReferencedObject
public void addReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY- Specified by:
addReferencedObject
in interfacecom.inet.report.ReferenceHolder
- Parameters:
reference
- the object to refer to- Since:
- 6.0
-
getReferencedObjects
public com.inet.report.ReferencedObject[] getReferencedObjects()
FOR INTERNAL USE ONLY- Specified by:
getReferencedObjects
in interfacecom.inet.report.ReferenceHolder
- Returns:
- the objects this field refers to
-
getReferencedObjectCount
public int getReferencedObjectCount()
FOR INTERNAL USE ONLY- Specified by:
getReferencedObjectCount
in interfacecom.inet.report.ReferenceHolder
- Returns:
- the number of distinct objects this field refers to
-
getRealReferencedObjectCount
public int getRealReferencedObjectCount()
FOR INTERNAL USE ONLY- Specified by:
getRealReferencedObjectCount
in interfacecom.inet.report.ReferenceHolder
- Returns:
- the number of total references, not distinct
- Since:
- 6.0
-
removeReferencedObject
public void removeReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY- Specified by:
removeReferencedObject
in interfacecom.inet.report.ReferenceHolder
- Parameters:
reference
- the reference to remove- Since:
- 6.0
-
setReferences
public void setReferences()
FOR INTERNAL USE ONLY- Specified by:
setReferences
in interfacecom.inet.report.ReferenceHolder
-
resetReferences
public void resetReferences()
FOR INTERNAL USE ONLY- Specified by:
resetReferences
in interfacecom.inet.report.ReferenceHolder
-
isUsed
public boolean isUsed()
FOR INTERNAL USE ONLY
-
setOptimized
public void setOptimized()
FOR INTERNAL USE ONLY- Specified by:
setOptimized
in interfacecom.inet.report.formula.IFormulaData
-
isOptimized
public boolean isOptimized()
FOR INTERNAL USE ONLY- Specified by:
isOptimized
in interfacecom.inet.report.formula.IFormulaData
- Returns:
true
if the AST of this formula field is optimized
-
parseElement
public NodeParser parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLParses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.
- Specified by:
parseElement
in interfaceNodeParser
- Overrides:
parseElement
in classField
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.tag
- The XMLTag to be parsedatts
- The set of attributes in the current XMLTagparserMap
- The map of current Parser.- Returns:
- The NodeParser sub-element if one needed to be created, or null if none was created.
- Throws:
FatalParserException
- if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
-
parseEndElement
public void parseEndElement(com.inet.report.parser.XMLTag group, java.lang.String tag, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLReceive notification of the end of an XML tag.
- Specified by:
parseEndElement
in interfaceNodeParser
- Overrides:
parseEndElement
in classField
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group.tag
- The XMLTag to be parsedparserMap
- The map of current Parser.- Throws:
FatalParserException
- if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
-
parseText
public void parseText(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLThis method is called if text was encountered in the context of this node. (Examples would be a formula's text or a text element's text)
- Specified by:
parseText
in interfaceNodeParser
- Overrides:
parseText
in classField
- Parameters:
text
- text encountered and to be storedparserMap
- The map of current Parser.
-
duplicate
public Field duplicate(java.lang.String name)
Duplicates this field with all its settings and returns the created Field with the given name. Note that the new formula field will not initially be referenced by any other report objects. If you duplicate a property formula, you will have to set the new formula as a separate property formula.
-
getNullBehavior
public int getNullBehavior()
Returns the null behavoir constant which was set for this formula field. This constant influences the way null values will be treated on evaluation time.- Returns:
- the behavior constant
- Since:
- 9.0
- See Also:
TREAT_NULL_AS_NULL
,TREAT_NULL_BY_DEFAULT
,TREAT_NULL_BY_EXCEPTION
-
setNullBehavior
public void setNullBehavior(int nullBehavior)
Sets the null behavoir constant. This constant influences the way null values will be treated on evaluation time. Invalid values will set the value to the next valid value.- Parameters:
nullBehavior
- the behavior constant- Since:
- 9.0
- See Also:
TREAT_NULL_AS_NULL
,TREAT_NULL_BY_DEFAULT
,TREAT_NULL_BY_EXCEPTION
-
usesSummaryFields
public boolean usesSummaryFields()
Returns true, if this formula field references to a summary field and is referenced by a summary field - either directly or indirectly- Returns:
- true if linked both ways to a summary field
- Since:
- 9.1
-
getTranslationKeys
public java.util.Set<java.lang.String> getTranslationKeys()
Returns a set of all translation keys used in the formula described by this field.
NOTE: This will re-parse the formula, which costs time and memory!- Returns:
- the translation keys or null, if there is no translation used
- Since:
- 9.1
-
validate
public Validity validate()
Check if the object is valid and returns the state and details of possible errors.- Specified by:
validate
in interfaceValidatable
- Returns:
- the current state, never null.
-
getLocalVariables
public com.inet.report.formula.Variables getLocalVariables()
Returns all local variables of this field- Specified by:
getLocalVariables
in interfacecom.inet.report.formula.IFormulaData
- Returns:
- the local variables of this field, it's never null
- Since:
- 10.0
-
clearLocalVariables
public void clearLocalVariables()
Resets the local variables of this field- Specified by:
clearLocalVariables
in interfacecom.inet.report.formula.IFormulaData
- Since:
- 10.0
-
setCurrentField
public void setCurrentField(Field currentField)
This field references the current report field, which contains this formula. If this is a property formula of a field element in a report, this variable will reference the field of the report element.
Whatever is set here, will be returned by the formula function 'currentFieldValue'.- Parameters:
currentField
- field to set as "current report field"- Since:
- 10.0
-
getCurrentField
public Field getCurrentField()
This field references the current report field, which contains this formula. If this is a property formula of a field element in a report, this variable will reference the field of the report element.
Whatever is set here, will be returned by the formula function 'currentFieldValue'.- Returns:
- the "current report field"
- Since:
- 10.0
-
setFormulaTree
public void setFormulaTree(com.inet.report.formula.Evaluable tree)
FOR INTERNAL USE ONLY- Specified by:
setFormulaTree
in interfacecom.inet.report.formula.IFormulaData
- Since:
- 10.1
-
getFormulaTree
public com.inet.report.formula.Evaluable getFormulaTree()
FOR INTERNAL USE ONLY- Specified by:
getFormulaTree
in interfacecom.inet.report.formula.IFormulaData
- Since:
- 10.1
-
-