gw_logo_08.gif (1982 bytes)  
Last edit: 2009-05-04 Graham Wideman

ModelRight

ModelRight Object Model Reference

<< ModelRight's Forward-engineering scripts

(Begin) Introduction to ModelRight scripting and automation  >>

Table of contents

Hierarchy order Alphabetical order

ModelRight Object Types

ScriptContext

Referenced from a VBScript running within the ModelRight app, this object provides access to the MRObject that the script is intended to operate upon. Also provides access to currently loaded database and some selected items in the ModelRight UI.

Category Member Args Returns Description
Gateway Object () IDispatch MRObject For ModelRight's database-manipulation scripts, ScriptContext.Object returns the "target" object, that is the object that ModelRight wants the script to operate upon. For example, for the Column/Alter Script, ScriptContext.Object provides an MRObject of type Column, that pertains to a particular column. For User Defined scripts, ScriptContext.Object provides an MRObject pertaining to the script itself. In either case, the returned MRObject can be used to get to the Model, etc.
Options () IDispatch MRObject Returns an MRObject as a container for Properties, used by ModelRight to pass options to the script.
ScriptDocument () IDispatch ScriptDocument Returns the ScriptDocument object to which to write (appearing in the script output window)
Database CurrentDatabase () String ???
PrevDatabase () String ???
Model Subset ContainedInSelectedModelSubset (Obj: IDispatch) Boolean Tells whether supplied MRObject is in SelectedModelSubset
HasSelectedModelSubset () Boolean ???
SelectedModelSubset () IDispatch MRObject? MRModel? ???
Migration MigratingColumn () MRObject? ???
MigratingRelation () MRObject? ???
UI selection IsSelectedObject (Obj: IDispatch) Boolean
TransactionsDelta IsAlterContext () Boolean Tells a script whether it's being called as part of an Alter operation or not

ScriptFramework

Provides access to over-arching functions, multiple models and meta model, some UI selections

Category Member Args Returns Description
Utility Initialize () In automation clients, must be called right after obtaining a ScriptFramework object
Model ActiveModels () IUnknown MRModelCollection ???
CloseModel (Model: IDispatch) For automation clients, call this when finished with model.
CreateModel () IDispatch MRModel Create a new model
CurrentModel () IDispatch MRModel The model that's active in the ModelRight window
LoadModel (ModelPath: String) IDispatch MRModel Load model from file (xxx\xxx.wer)
Model (ModelId: String) IDispatch MRModel Get the model of the name supplied.
SaveModel (ModelPath: String, Model: IDispatch) Save model to file
MRObject CreateObject (type: String, Owner: IDispatch) IDispatch MRObject? Create an MRObject of the named type
CreateObjectById (type: Long, Owner: IDispatch) IDispatch MRObject? Same as CreateObject, but by integer type.
DeleteObject (Object: IDispatch) Boolean -
Property CreatePropertyValue (ObjType: String, PropType: String) IDispatch MRPropertyValue Use MetaModel to create a MRPropertyValue of the appropriate datatype.
CreatePropertyValueById (ObjType: Long, PropType: Long) IDispatch MRPropertyValue Like CreatePropertyValue, but using integer PropType
MetaModel MetaModel () IDispatch MRMetaModel The MetaModel currently in effect (specific to particular database product).
UI selection CurrentDrawableSelection () IUnknown MRObjectCollection The Graphics of the items currently selected in the ModelRight UI
CurrentSelection () IUnknown MRObjectCollection The data model items currently selected in the ModelRight UI
Misc Evaluate (Property: String) String Runs a script, returns the Document output text.

ScriptDocument

From VBScript within the ModelRight app, this object acts as an output destination for text, which can be viewed in the Script Explorer > Property Browser > Script panel. If SQL statements are written to this output doc, ModelRight can pass these to the selected database for execution.

Category Member Args Returns Description
Utility Write (Val: String) Writes a string to the script's "output document". No final line break; use WriteLine instead to get linebreak.
WriteLine (Val: String) Writes a string to the script's "output document", ended with line break.

MRObjectCollection

Collection of MRObjects

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
Count () Long Count of items in collection
Item (Index: Long) Variant MRObject Object at index

MRObject

Generic holder of data about a database element (table, view, field etc)

Category Member Args Returns Description
Identity Equals (Obj: IDispatch) Boolean Does this calculate object identity or value equality?
Id () Long Integer Id
Name () String -
Type IsValid () Boolean When is an MRObject invalid?
type () Long Type within the ModelRight world: 6=Table, 14=View, 7=Column etc.
TypeName () String String version of object type: "Table", "View" etc
Children AllChildren () IUnknown MRObjectCollection -
ChildByName (type: String, Name: String) IDispatch MRObject Access a child of particular type and name
ChildByOrder (type: String, Order: Long) IDispatch MRObject Access children of a particular type, in order.
ChildOrder (Child: IDispatch) Long Tells order number of a child object within the children collection of the current object
Children (type: String) IUnknown MRObjectCollection Returns Children that match type Type
ChildrenById (type: Long) IUnknown MRObjectCollection Returns an collection of child objects, matching a type number.
ChildrenByIdSortedByName (type: Long) IUnknown MRObjectCollection Returns an collection of child objects, matching a type number, sorted by Name.
ChildrenSortedByName (type: String) IUnknown MRObjectCollection Returns an collection of all child objects sorted by Name.
HasChildrenByType (PropType: String) Boolean
SetChildOrder (Child: IDispatch, Order: Long) Boolean Success??? Within this MRObjects children, move Child to be at index Order. (one based)
Ancestor Model () IDispatch MRModel -
OldOwner () IDispatch MRObject? ???
Owner () IDispatch MRObject? -
Properties DeleteProperty (type: String) Boolean -
DeletePropertyById (type: Long) Boolean -
HasLocalProperty (PropType: String) Boolean Tells whether named property has local value overriding inherited value
HasLocalPropertyById (PropType: Long) Boolean Like HasLocalProperty, but by integer Id.
HasProperty (PropType: String) Boolean Tell whether property exists
HasPropertyById (PropType: Long) Boolean Tells whether property exists, by integer Id
InheritsFrom () IUnknown ??? MRObject (or Collection???) from which this MRObject inherits property values
Properties () IUnknown MRPropertyCollection returns collection of all properties on this MRObject
Property (type: String) IDispatch MRProperty Return the Property having Property.Name = "type" (ie: the "type" arg here is misnamed).
PropertyById (type: Long) IDispatch MRProperty Return the Property selected by integer Id.
SetDatatype (Datatype: String) Special for Column objects: Sets column property Datatype. (Because the Datatype property takes an MRObject value, and is otherwise complicated.)
SetProperty (type: String, Prop: IDispatch) Boolean Add this property to MRObject (possibly replacing same-named one already there).
SetPropertyById (type: Long, Prop: IDispatch) Boolean Like SetProperty, but by integer Id
SQL AlterStatement () String -
CreateStatement () String -
DropStatement () String -
TransactionsDelta HasLocalOriginalProperty (PropType: String) Boolean See Transactions documentation
HasOriginalProperty (PropType: String) Boolean See Transactions documentation
ModifiedChildrenPosition () IUnknown ChildOrderItemCollection? See Transactions documentation
ModifiedProperties () IUnknown MRPropertyCollection? See Transactions documentation
OriginalChildren (type: String) IUnknown ??? See Transactions documentation
OriginalProperty (type: String) IDispatch MRProperty See Transactions documentation
Misc Evaluate (Property: String) String Runs the script pertaining to this MRObject and named by the Property argument. Returns the Document output text.
ReferencedBy () IUnknown MRObjectCollection listing MRObjects which refer to this MRObject

MRModelCollection

Collection of MRModels (see ScriptFramework)

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
Count () Long Count of items in collection
Item (Index: Long) Variant MRModel Model at index

MRModel

Root of database model data

Category Member Args Returns Description
Identity AsObject () IDispatch MRObject An MRModel object also includes the features of an MRObject (properties and children etc). The AsObject member gives access to that part of MRModel.
Id () String GUID in string form
Name () String -
MetaModel MetaModel () IDispatch MRMetaModel Returns a reference to a (the?) MRMetaModel that describes the allowable structure of a ModelRight database model.
Transactions BeginTransaction (pVal: String) Begin series of changes to model. Provide caption for change.
CanRedo () Boolean
CanUndo () Boolean
EndTransaction () End series of changes and allow them to take effect.
Redo () -
RollbackTransaction () End series of changes, and roll them back.
Undo () -

MRPropertyCollection

Collection of MRProperty objects

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
Count () Long Count of items in collection
Item (Index: Long) Variant MRProperty Property at Index

MRProperty

Property of an MRObject

Category Member Args Returns Description
Identity Name () String -
Property Value () IDispatch MRPropertyValue Returns object holding a value
Type type () Long Numeric type of property

MRPropertyValue

Holds value of an MRProperty

Category Member Args Returns Description
Set FromBoolean (Val: Boolean) -
FromDouble (Val: Double) -
FromInteger (Val: Long) -
FromObject (Val: IDispatch) -
FromString (Val: String) -
Get AsBoolean () Boolean -
AsDouble () Double -
AsInteger () Long -
AsObject () IDispatch MRObject -
AsString () String -
AsVector () IUnknown MRVectorPropertyValue -
Test type IsBooleanProperty () Boolean -
IsDoubleProperty () Boolean -
IsIntegerProperty () Boolean -
IsNull () Boolean -
IsObjectProperty () Boolean -
IsStringProperty () Boolean -
IsVectorProperty () Boolean -

MRVectorPropertyValue

Holds vector of an MRPropertyValue if value is vector type

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
AddValue (Val: IDispatch) ??? Not sure why Val is Dispatch
Count () Long Count of items in collection
Item (Index: Long) Variant Not sure type returned Value at index

MRMetaModel

Root of Meta Model

Category Member Args Returns Description
MetaObjects MetaObject (type: String) IDispatch MRMetaObject -
MetaObjectById (type: Long) IDispatch MRMetaObject Get a MetaObject by integer Id
MetaObjects () IUnknown MRMetaObjectCollection -

MRMetaObjectCollection

Collection of MetaObjects

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
Count () Long Count of items in collection
Item (Index: Long) Variant MRMetaObject MetaObject at index

MRMetaObject

Generic holder of data about a model element (like meta-table, meta-field etc)

Category Member Args Returns Description
Identity Name () String -
Type type () Long Numeric code for type of MRMetaObject
MetaObjects MetaObject (type: String) IDispatch MRMetaObject -
MetaObjectById (type: Long) IDispatch MRMetaObject Get a child MetaObject by integer Id
MetaObjects () IUnknown MRMetaObjectCollection -
MetaProperties MetaProperties () IUnknown MRMetaPropertyCollection -
MetaProperty (type: String) IDispatch MRMetaProperty Get a Property by "type" (actually property Name)
MetaPropertyById (type: Long) IDispatch MRMetaProperty Get a Property by integer Id

MRMetaPropertyCollection

Collection of MetaProperty objects

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
Count () Long Count of items in collection
HasProperty (PropType: String) Boolean
Item (Index: Long) Variant MRMetaProperty MetaProperty at index

MRMetaProperty

Property of a MetaObject

Category Member Args Returns Description
Identity Name () String -
Type type () Long Data type of property

ChildOrderItemCollection

Not sure what this is for

Category Member Args Returns Description
Collection _NewEnum () IUnknown (Allows use in For Each statement)
Count () Long Count of items in collection
Item (Index: Long) Variant ChildOrderItem ChildOrderItem at index

ChildOrderItem

Not sure what this is for

Category Member Args Returns Description
Children Child () IDispatch ??? ???
Position NewPosition () Long ???
OldPosition () Long ???

Generated on: 5/4/2009 5:40:27 AM


Document Status
Date (reverse) Who Description
     
2009-05-04 GW Updated