CalculationLine
Synopsis
struct CalculationLine {
InactiveFlag[] inactive;
int level;
int counter;
CalculationRule? calcRule; // optional attribute
boolean? calcRuleEditable; // optional attribute
string* conditionType;
string description;
Value* amount;
Quantity* qtyRelation;
Money* value;
CSValidationError groupError,
CSValidationError error
boolean amountEditable;
boolean amountEdited,
boolean qtyRelationEditable;
boolean conditionRemovable,
boolean ValueEditable
}
See also: InactiveFlag, Value, Quantity, Money, CSValidationError, CalculationRule
Provides details of a calculation line.
The element inactive has zero or more occurrences. If there is at least one occurrence, the condition is inactive. The individual elements describe one or more reasons for the inactivity of the condition.
level and counter describe the position of the calculation line in the calculation sheet. Whereas counter describes the position inside a level.
If amountEditable is true a value can be set to this calculation line via setConditionAmount (§setConditionAmount).
If qtyRelationEditable is true the quantity relation can be changed via setQuantityRelation (§setQuantityRelation).
The operation getPriceCalculationSheet may return calculation lines with elements amount, qtyRelation and value that do not have a non-empty value attribute, indicating an invalid amount, quantity relation or value.
See also: getPriceCalculationSheet
ConditionRemovable: The value of this attribute is true if the line is a condition line that can be removed.
The information about addable and removable conditions is valid at the time the calculation sheet was returned by the server. Changes to the configuration of the article or to the calculation itself may invalidate this information.
Field groupError is present if and only if the line represents a group condition (this also includes header conditions) and there was an error validating the condition group.
Field error is present if there was an error validating the calculation line and the error is not suppressed.
An error is suppressed if:
-
It can be ignored because the line represents an item condition with no valid data (as is the case, for example, after a manual condition has been added and before a condition amount has been set). Even though such lines have an invalid condition value, this doesn’t matter as their outgoing value is always equal to their incoming value, and their condition value is ignored by reference ranges and aggregate conditions.
-
The value is clearly a follow-up error. As of now the only errors considered follow-up errors are those of type CSInvalidValueError, and only if
-
The incoming value of a line is invalid because the outgoing value of the parent line is invalid,
-
The reference value of a line is invalid because the outgoing value, condition value, or subtotal value of a referenced line is invalid, or
-
The value of an item or aggregate subtotal is invalid because the incoming value is invalid, unless it is an item subtotal with no parent line. (This matters only for subtotals that compute their value as the difference of incoming value and base value, as is the case for subtotals that represent a margin, as all other subtotals simply use the base value as their value, and an invalid base value is covered by above two conditions.)
An user interface may choose to ignore errors (field error) of item calculations, or treat them as less severe, if they are of type CSInvalidValueError with result kind GroupCondBase and parameter kind CondBase, as such errors are probably follow-up errors of another error in the same item calculation or of an error in another item calculation with a condition in the same condition group.
calcRule and calcRuleEditable
Both attributes are present if and only if the line is a condition line. calcRule reports its current calculation rule; calcRuleEditable reports whether that rule can currently be edited. Use setCalculationRule and resetCalculationRule to change or reset it.