Skip to content
Reference > AmiScript API > Classes

FormulaSetEditor

Definition

FormulaSetEditor var = .... ;

Extends

Extended By

None

Description

editor exposing a fixed, named-slot set of formulas (e.g. chart series X/Y/group/color). Slots are defined by the implementing portlet's schema; you can update or validate each slot's expression by name, but slots cannot be added or removed at runtime.

Method Summary

Owner Name Return Type Description
PanelEditor apply() Boolean Persist the editor working copy to the underlying object. Call validate() first.
PanelEditor close() Boolean Dismiss this editor's window and unregister it from the editor registry. Triggers the same lifecycle as the user clicking the window's close button.
PanelEditor getBinding() Map Return the editor's binding metadata as a map: {handle, editorType, contentType, ari, name, parentHandle, scope, capabilities:[...], readonly}. Use this to ask 'what kind of editor is this?' or 'can I setCode on it?' (check capabilities for 'set_code') without runtime-type-checking the editor instance.
Object getClassName() String Returns the string name of this object's class type.
FormulaSetEditor getFormula(name) String Return a named formula's current working-copy text.
FormulaSetEditor getFormulaNames() List Return formula names available on this editor.
PanelEditor getHandle() String Return this editor's stable session handle.
PanelEditor getRevision() Long Return the editor's monotonic working-copy revision.
PanelEditor hasChanged() Boolean Return true if the working copy differs from persisted state.
PanelEditor open() Boolean Open this editor in the UI, bringing it onto the user's screen if it is not already visible. Editing can be done without calling open().
PanelEditor revert() Boolean Discard unsaved working-copy changes and return to persisted state.
FormulaSetEditor setFormula(name, formula) Long Set a named formula. Returns the new revision (use it to chain subsequent stale-write-protected operations). Use trySetFormula() if you need to detect concurrent edits before writing.
PanelEditor test() Map Execute the editor's payload in its runtime context without persisting. Returns {ok, revision, returnValue, output, errorMessage}. Only valid when capabilities contains 'test' -- other editor kinds return a not-supported result. Mirrors the editor_test admin/MCP shape.
Object toJson() String Returns a string of a json representation of this object.
FormulaSetEditor trySetFormula(name, formula, expectedRevision) Map Set a named formula only if expectedRevision is current. Returns {applied, revision}: applied=true and the new revision on success; applied=false and the editor's current revision on stale (retry with that revision).
PanelEditor validate() Map Validate the editor's working copy. Returns {ok, revision, diagnostics}. Does not surface validation errors as UI alerts -- callers inspect the returned diagnostics list instead.
FormulaSetEditor validateFormula(name) Map Validate one named formula and return {ok, revision, diagnostics}.

Method Definitions


apply()

Boolean PanelEditor::apply()

Description

Persist the editor working copy to the underlying object. Call validate() first.


close()

Boolean PanelEditor::close()

Description

Dismiss this editor's window and unregister it from the editor registry. Triggers the same lifecycle as the user clicking the window's close button.


getBinding()

Map PanelEditor::getBinding()

Description

Return the editor's binding metadata as a map: {handle, editorType, contentType, ari, name, parentHandle, scope, capabilities:[...], readonly}. Use this to ask 'what kind of editor is this?' or 'can I setCode on it?' (check capabilities for 'set_code') without runtime-type-checking the editor instance.


getClassName()

String Object::getClassName()

Description

Returns the string name of this object's class type.


getFormula(name)

String FormulaSetEditor::getFormula(String name)

Description

Return a named formula's current working-copy text.

Parameter Definition

Name Type Description
name String 

getFormulaNames()

List FormulaSetEditor::getFormulaNames()

Description

Return formula names available on this editor.


getHandle()

String PanelEditor::getHandle()

Description

Return this editor's stable session handle.


getRevision()

Long PanelEditor::getRevision()

Description

Return the editor's monotonic working-copy revision.


hasChanged()

Boolean PanelEditor::hasChanged()

Description

Return true if the working copy differs from persisted state.


open()

Boolean PanelEditor::open()

Description

Open this editor in the UI, bringing it onto the user's screen if it is not already visible. Editing can be done without calling open().


revert()

Boolean PanelEditor::revert()

Description

Discard unsaved working-copy changes and return to persisted state.


setFormula(name,formula)

Long FormulaSetEditor::setFormula(String name, String formula)

Description

Set a named formula. Returns the new revision (use it to chain subsequent stale-write-protected operations). Use trySetFormula() if you need to detect concurrent edits before writing.

Parameter Definition

Name Type Description
name String 
formula String 

test()

Map PanelEditor::test()

Description

Execute the editor's payload in its runtime context without persisting. Returns {ok, revision, returnValue, output, errorMessage}. Only valid when capabilities contains 'test' -- other editor kinds return a not-supported result. Mirrors the editor_test admin/MCP shape.


toJson()

String Object::toJson()

Description

Returns a string of a json representation of this object.


trySetFormula(name,formula,expectedRevision)

Map FormulaSetEditor::trySetFormula(String name, String formula, Long expectedRevision)

Description

Set a named formula only if expectedRevision is current. Returns {applied, revision}: applied=true and the new revision on success; applied=false and the editor's current revision on stale (retry with that revision).

Parameter Definition

Name Type Description
name String 
formula String 
expectedRevision Long 

validate()

Map PanelEditor::validate()

Description

Validate the editor's working copy. Returns {ok, revision, diagnostics}. Does not surface validation errors as UI alerts -- callers inspect the returned diagnostics list instead.


validateFormula(name)

Map FormulaSetEditor::validateFormula(String name)

Description

Validate one named formula and return {ok, revision, diagnostics}.

Parameter Definition

Name Type Description
name String