report.PatternCaption#

class PatternCaption#

Bases: Flow360BaseModel

Class for setting up chart caption.

Attributes

pattern: str#

The caption pattern containing placeholders like [case.name] and [case.id]. These placeholders will be replaced with the actual case name and ID when resolving the caption. For example, “The case is [case.name] with ID [case.id]”. Defaults to "[case.name]".

Default:

'[case.name]'

Additional Constructors

classmethod from_file(filename)#

Load a Flow360BaseModel from a .json file.

Parameters:

filename (str)

Return type:

Flow360BaseModel

Methods

resolve(case)#

Resolves the pattern to the actual caption string using the provided case object.

Parameters:

case (Case) – The case object containing name and id attributes.

Returns:

The resolved caption string with placeholders replaced by actual values.

Return type:

str

Examples

>>> caption = PatternCaption(pattern="The case is [case.name] with ID [case.id]")
>>> case = Case(name="Example", id=123)
>>> caption.resolve(case)
'The case is Example with ID 123'
help(methods=False)#

Print fields and methods of a Flow360BaseModel using rich.

Parameters:

methods (bool)

Return type:

None

to_file(filename, **kwargs)#

Export Flow360BaseModel instance to a .json file.

Parameters:
Return type:

None