Field Parameters
Copyright (C) 2023 Cadence Design Systems, Inc. (Cadence)
- class orionplatform.parameters.fields.BooleanFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a boolean field parameter.
- class orionplatform.parameters.fields.DecimalFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a float field parameter.
- class orionplatform.parameters.fields.FieldParameter(name: str | None = None, field_type=None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', nullable: bool = False, **kwargs)
Bases:
floe.api.parameters.StringParameter
Parameter that constructs a OEField object for OERecord/OEMolRecord. The user of a cube with a FieldParameter will be able to specify the name of the OEField. The default field name, field type and meta are specified by the cube writer when this parameter is constructed.
- Parameters:
field_type (datarecord.types.ObjectBase or datarecord.types.PODBase) – The type of the field parameter commonly comes from the
datarecord.Types
namespacefield_meta (datarecord.OEFieldMeta) – Metadata for the field
read_only (bool) – If True, then passing the field to a record method that changes the record will throw an exception
nullable (bool) – If True, a field may exist with a null value
Warning
FieldParameters are supported as Cube parameters, but not as WorkFloe parameters. FieldParameters are not intended to be used directly. Subclasses should be used instead.
See also
- class orionplatform.parameters.fields.FieldSelector(name)
Utility class for accessing fields by name from OERecords.
- Parameters:
name (string) – String to match the field name with
- get_field(record)
Retrieve a field with a matching name from an OERecord
- Parameters:
record (OERecord) – OERecord to find matching field on
- Returns:
OEField with same name as set on the selector.
- Raises:
ParameterException – Unable to find field
- get_value(record)
Retrieve the value associated with the matching field from the OERecord
- Parameters:
record (OERecord) – OERecord to find value on
- Returns:
Value associated with the field
- Raises:
ParameterException – Unable to find field
- class orionplatform.parameters.fields.FieldSelectorParameter(name: str | None = None, title: str | None = None, default=None, null: bool = False, help_text: str = '', promoted: bool = False, promoted_name: str | None = None, required: bool = False, hidden: bool = False, value=None, static: bool = False, max_value=None, min_value=None, max_length=None, choices=None, level='basic', description: str = '', many: bool = False, order: int | None = None)
Bases:
floe.api.parameters.StringParameter
Parameter that returns an instance of
FieldSelector
that can be used to retrieve a field that has the same name as provided to the parameter. The Orion UI will allow you to select a field from those available in a chosen Dataset.Warning
The fields returned by this object are of any arbitrary type. If different records have fields of different types but with the same name, the user will need to handle that scenario.
Example Usage
class FieldSelectorCube(RecordPortsMixin, ComputeCube): selector = FieldSelectorParameter() def process(self, record, port): # If not required, the default value will return a None object if self.args.selector is not None: field = self.args.selector.get_field(record) # Get value using retrieved field value = record.get_value(field) # Get value using selector value = self.args.selector.get_value(record)
- orionplatform.parameters.fields.FloatFieldParameter
alias of
DecimalFieldParameter
- class orionplatform.parameters.fields.InputMolFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a field parameter that will provide an OEPrimaryField that provides access to a record’s Primary Molecule in read only mode.
- class orionplatform.parameters.fields.IntegerFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating an integer field parameter.
- class orionplatform.parameters.fields.LinkFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a link field parameter.
- class orionplatform.parameters.fields.MolFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a field parameter of type molecule.
- class orionplatform.parameters.fields.OutputMolFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a field parameter that will provide an OEPrimaryField that can be used for attaching a molecule to a record.
- class orionplatform.parameters.fields.PrimaryMolFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a field parameter that will provide an OEPrimaryField that provides access to a record’s Primary Molecule
If a default value is provided or a new value is provided at runtime this will return a OEField with its type as Types.Chem.Mol. Which can be used for modifying where a molecule is placed on a record at run time.
- class orionplatform.parameters.fields.StringFieldParameter(name: str | None = None, field_meta: OEFieldMeta | None = None, title: str | None = None, default=None, required: bool = False, read_only: bool = False, help_text: str = '', description: str = '', **kwargs)
Convenience class for creating a field parameter of type string.