Skip to main content

OptionObject

Legacy Object

A newer version of this object is now available (OptionObject2015) and is recommended for new projects.

The OptionObject holds all of the content of and metadata describing the calling myAvatar form. AvatarScriptLink.NET adds several utility methods to assist with handlings these objects.

Properties

PropertyDescription
EntityIDThe unique Id of the selected entity. I.e., Patient, Staff, or User.
EpisodeNumberThe selected Episode Number. Will be null if the form is non-episodic.
ErrorCodeInforms myAvatar of the outcome of the ScriptLink API call.
ErrorMesgMessage to display to user with certain error codes.
FacilityThe Facility Id the user is currently working in.
FormsList of myAvatar form sections including rows and fields. See FormObject.
OptionIdThe unique Id of the form that sent this request.
OptionStaffIdThe Staff Id assigned to the logged on user. May be null/empty if not associated with a Practitioner.
OptionUserIdThe User Id of the logged on user.
ServerNameThe server the request was submitted from.
SystemCodeThe System Code the user is currently working in.

Methods

The following methods are available on the OptionObject to assist with common tasks.

MethodDescription
AddFormObject(FormObject)Adds a FormObject to the OptionObject.
AddFormObject(string, bool)Creates a FormObject with specified FormId and adds to the OptionObject2015. The second parameter specifies whether the FormObject should be flagged as a Multiple Iteration form.
AddRowObject(string, RowObject)Adds a RowObject to the FormObject with the specified FormId.
Builder()Initializes a builder for constructing a OptionObject.
Clone()Clones the OptionObject.
DeleteRowObject(RowObject)Marks a for deletion.
DeleteRowObject(string)Marks a for deletion by specified RowId.
DisableAllFieldObjects()Sets all FieldObjects as disabled.
DisableAllFieldObjects(List of string)Sets all FieldObjects as disabled except for any listed to be excluded.
Equals(OptionObjectBase)Used to compare two OptionObject to determine if they are equal. Returns bool.
Equals(object)Used to compare OptionObject to an object to determine if they are equal. Returns bool.
GetCurrentRowId(string)Returns the CurrentRow RowId of the form matching the FormId.
GetFieldValue(string)Returns the first value of the field matching the Field Number.
GetFieldValue(string, string, string)Returns the value of the matching the Field Number on the specified FormObject and RowObject.
GetFieldValues(string)Returns the values of the field matching the Field Number.
GetHashCode()Overrides the GetHashCode method for a OptionObjectBase.
GetMultipleIterationStatus(string)Returns the Multiple Iteration Status of the form matching the FormId.
GetParentRowId(string)Returns the CurrentRow ParentRowId of the form matching the FormId.
Initialize()Initializes an empty OptionObject.
IsFieldEnabled(string)Returns whether the specified field is enabled.
IsFieldLocked(string)Returns whether the specified field is locked.
IsFieldModified(string)Returns whether the specified field is modified.
IsFieldPresent(string)Returns whether the specified field is present.
IsFieldRequired(string)Returns whether the specified field is required.
IsFormPresent(string)Returns whether the specified form is present.
IsRowMarkedForDeletion(string)Returns whether the specified RowObject is marked for deletion.
IsRowPresent(string)Returns whether the specified row is present
SetDisabledField(string)Sets the specified field as disabled.
SetDisabledFields(List of string)Sets the specified fields as disabled.
SetEnabledField(string)Sets the specified field as enabled.
SetEnabledFields(Listof string)Sets the specified fields as enabled.
SetFieldValue(string, string)Sets the FieldValue of a FieldObject in the OptionObject on the first form's CurrentRow.
SetFieldValue(string, string, string, string)Sets the FieldValue of a FieldObject in the OptionObject.
SetLockedField(string)Sets the specified field as locked.
SetLockedFields(List of string)Sets the specified fields as disabled.
SetOptionalField(string)Set the specified field as not required and enables if disabled.
SetOptionalFields(List of string)Set the specified fields as not required and enables if disabled.
SetRequiredField(string)Sets the specified field as required.
SetRequiredFields(List of string)Sets the specified fields as required.
SetUnlockedField(string)Set the specified field as unlocked.
SetUnlockedFields(List of string)Set the specified fields as unlocked.
ToHtmlString()Returns a string with all of the contents of the OptionObject formatted in HTML.
ToHtmlString(bool)Returns a string with all of the contents of the OptionObject formatted in HTML. Passing true will include HTML header tags.
ToJson()Returns a string with all of the contents of the OptionObject formatted as JSON.
ToOptionObject()Creates a clone of the OptionObject.
ToOptionObject2()Transforms the OptionObject2 to an OptionObject2.
ToOptionObject2015()Transforms the OptionObject2 as an OptionObject2015.
ToReturnOptionObject()Creates an OptionObject with the minimum information required to return.
ToReturnOptionObject(int, string)Creates an OptionObject with the minimum information required to return plus the provided Error Code and Message.
ToXml()Returns a string with all of the contents of the OptionObject formatted as XML.

Examples

The following code shows how to use OptionObject to construct a web service compatible with myAvatar.

Detailed Class Diagram