Initializing help system before first use

# xpressinsight.types.Scalar

Purpose
Creates an annotation for a scalar entity in an app.
Synopsis
`xpressinsight.types.Scalar(default: bool | float | int | str = None, dtype: Type[BasicType] = None, alias: str = '', format: str = '', hidden: Hidden = Hidden.FALSE, manage: Manage = Manage.INPUT, read_only: bool = False, transform_labels_entity: str = '', update_after_execution: bool = False, *, update_keep_result_data: bool = False, update_progress: bool = False) -> Type[bool | float | int | str]`
Arguments

default | The initial value; if specified, must be a value of the appropriate type for the dtype of this entity (e.g. a str if dtype is string).
dtype | The data type; one of boolean, real, integer or string.
alias | Used to provide an alternative name for an entity in the UI. The value is used in place of the entity name where appropriate in the UI.
format | The formatting string used for displaying numeric values.
hidden | Indicates whether the UI should hide the entity where appropriate.
manage | How and whether Insight handles an entity. Defines how the system manages the entity data.
read_only | Whether an entity is readonly. Specifies that the value(s) of the entity cannot be modified. See also hidden.
transform_labels_entity | The name of an entity in the schema from which to read labels for values of this entity. The type of the index set of the labels entity must match the data type of this entity. The data type of the labels entity can be any primitive type.
update_after_execution | Whether the value of the entity in the scenario is updated with the value of the corresponding model entity at the end of the scenario execution. If True the value of the entity is updated to correspond with the model entity after execution.
update_keep_result_data | Whether to retain result data when this input entity is updated outside a scenario execution (e.g. in a view or a REST API call). If False, the result data may be deleted when a view or REST API request updates this entity, depending on the configuration of AppConfig.result_data. If True, the result data will not be deleted when this entity is updated.
update_progress | Whether the value of the entity in the scenario is sent on progress updates. If True the value of the entity will be written back to the Insight repository when insight.send_progress_update is called from an execution mode where the send_progress attribute is True.

Example
Some examples of declaring scalar entities in the data model.

    >>> @xi.AppConfig(name="My First Insight Python App",
    ...               version=xi.AppVersion(0, 1, 2))
    ... class MyApp(xi.AppBase):
    ...
    ...     # Examples where data type is inferred from initial value
    ...     # Scalar "NumFactory" of type "xi.integer"; initial value 10
    ...     NumFactory: xi.types.Scalar(10)
    ...     # Scalar "IsOn" of type "xi.boolean"; initial value True
    ...     IsOn: xi.types.Scalar(True)
    ...
    ...     # Examples where data type is explicitly given and value
    ...     # will be initialized to a type-specific default
    ...     RealScalar: xi.types.Scalar(dtype=xi.real)      # default value 0.0
    ...     StringScalar: xi.types.Scalar(dtype=xi.string)  # default value ""

Further information
1. The function Scalar is part of the package xpressinsight.types.
2. This function returns an Annotated type containing the Scalar entity object; for example, if xpressinsight has been imported as xi, then xi.types.Scalar(dtype=xi.integer) is equivalent to Annotated[int, xi.Scalar(dtype=xi.integer)].
3. Parameters before update_progress can be specified positionally for reasons of backwards compatibility, but it's recommended that you always use named arguments if you're specifying parameters other than default, dtype and alias.
Related topics
BasicType,
Hidden,
Manage,
Scalar,
types.Param
Parent Topic App Entity Definitions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.