Qiq_property

Qiq_property implements a property bag - a collection of properties that are cosntructed from a sring which contains a set of delimited values that describe the objects and the properties that these objects have.

The string used to construct the object is in the following format object_key_1=prop_1~prop_1_val_1~prop_1~val_n|prop_2~prop_2_val_1~prop_2~val_n|etc object_key_2=prop_1~prop_1_val_1~prop_1~val_n|prop_2~prop_2_val_1~prop_2~val_n|etc etc...

Function Summary

TypeName
voidQiq_deleteObjectString in_strObjKey )
Deletes an object from the collection
voidQiq_deletePropertyString in_strObjKey, String in_strPropKey )
Deletes a second level property from the collection
voidQiq_getCollectionShape in_list )
Adds the list of keys in the collection of objects to the list box or drop-down
HashedArrayQiq_getKeys()
Returns a hashed array of the keys in this Qiq_property object
HashedArrayQiq_getObjectString in_strKey )
Returns the object as an hashed Array of property keys that reference an array of associated values
ArrayQiq_getPropertiesString in_strObjKey, String in_strPropKey )
Returns a property value that is an array
StringQiq_getPropertyString in_strObjKey, String in_strPropKey )
Returns a string property value.
BooleanQiq_getPropertyAsBooleanString in_strObjKey, String in_strPropKey )
Returns a Boolean property value.
IntegerQiq_getPropertyAsIntegerString in_strObjKey, String in_strPropKey )
Returns an integer property value.
StringQiq_propertyString in_string, Boolean in_blnEscaped, Array in_arrSeparators, Boolean in_blnSeparateValueInstances )
Constructor for Qiq_property object. It converts a string of flattened object properties into a collection of objects with their properties. It returns an error string if an error is detected and exit
voidQiq_setObjectString in_strKey, HashedArray in_harObject )
Replaces the properties associated with the object key with the hashed array of values or a single string value it is provided with.
voidQiq_setPropertyString in_strObjKey, String in_strPropKey, Object in_propertyValue )
This method sets the value or values of an object's property. Old values are lost and are replaced by the new value
StringQiq_toStringBoolean in_blnPartialEscape )
Serializes the object - this is the opposite of what the constructor does. THis method is most often used to make a in-memory object persistent by writing it out to a text label

Detailed Function Reference


void Qiq_deleteObject( String in_strObjKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Deletes an object from the collection

Parameters
in_strObjKey

The key of the object to be deleted


void Qiq_deleteProperty( String in_strObjKey, String in_strPropKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Deletes a second level property from the collection

Parameters
in_strObjKey

The key of the object to be deleted

in_strPropKey

The key of the property to be deleted


void Qiq_getCollection( Shape in_list )
Defined in Globals_EIS.cbtPropertyList.OnClick

Adds the list of keys in the collection of objects to the list box or drop-down

Parameters
in_list

List box or drop-down to return the object keys into


HashedArray Qiq_getKeys()
Defined in Globals_EIS.cbtPropertyList.OnClick

Returns a hashed array of the keys in this Qiq_property object

Return value
HashedArray

HashedArray Qiq_getObject( String in_strKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Returns the object as an hashed Array of property keys that reference an array of associated values

WARNING regarding the values in the hashed array returned: If you're expecting a value to be an array, bear in mind that it won't always be the case. If an array was stored (using Qiq_setObject or Qiq_setProperty) with many values, it will be deserialized as a regular array. But if an array was stored with only ONE VALUE, it will be deserialized as a STRING. If your app is expecting an array all the time, not a string, you must test and change it to an array manually. Or you could call the Qiq_getProperties function if you know the first and second level keys.

Parameters
in_strKey

the key of the object of interest

Return value
HashedArray

Array Qiq_getProperties( String in_strObjKey, String in_strPropKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Returns a property value that is an array

Parameters
in_strObjKey

The 1st level key (the word before '=')

in_strPropKey

The 2nd level key (the word before '~')

Return value
Array

of values (or an empty array if there is no such property value)


String Qiq_getProperty( String in_strObjKey, String in_strPropKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Returns a string property value.

Parameters
in_strObjKey

The 1st level key (the word before '=')

in_strPropKey

The 2nd level key (the word before '~')

Return value
String

The property value


Boolean Qiq_getPropertyAsBoolean( String in_strObjKey, String in_strPropKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Returns a Boolean property value.

Parameters
in_strObjKey

The 1st level key (the word before '=')

in_strPropKey

The 2nd level key (the word before '~')

Return value
Boolean

The property value


Integer Qiq_getPropertyAsInteger( String in_strObjKey, String in_strPropKey )
Defined in Globals_EIS.cbtPropertyList.OnClick

Returns an integer property value.

Parameters
in_strObjKey

The 1st level key (the word before '=')

in_strPropKey

The 2nd level key (the word before '~')

Return value
Integer

The property value, NaN if Qiq_getProperty is invalid


String Qiq_property( String in_string, Boolean in_blnEscaped, Array in_arrSeparators, Boolean in_blnSeparateValueInstances )
Defined in Globals_EIS.cbtPropertyList.OnClick

Constructor for Qiq_property object. It converts a string of flattened object properties into a collection of objects with their properties. It returns an error string if an error is detected and exit

Parameters
in_string

A block of serialized text to form the object from, or an empty string if you're re-constructing the object

in_blnEscaped

True if you want characters in the serialized text to be escaped

in_arrSeparators

Optional array of custom Separators if the standard set ["\r\n", "=" , "|", "~"] are not suitable

in_blnSeparateValueInstances

Indicates that multi-valued properties each have their property name as part of the string representation, for example child~Mary~Micheal~Peter would have this false or null, child~Mary|child~Michael|child~Peter requires this parameter to be true

Return value
String

Only if there is an error message


void Qiq_setObject( String in_strKey, HashedArray in_harObject )
Defined in Globals_EIS.cbtPropertyList.OnClick

Replaces the properties associated with the object key with the hashed array of values or a single string value it is provided with.

This method sets the value or values of all the properties of an object. Old properties and values are lost and are replaced by the new set of values

WARNING regarding the second param, in_harObject: Contents of this hashed array will be stored. A value in this hashedArray can itself be an array, If the value is an array with many values, it will be deserialized as a regular array if you call Qiq_getObject(). But the value is an ARRAY with only ONE VALUE, it will be deserialized as a STRING when you call Qiq_getObject(). If your app is expecting an array, not a string, you must test and change it to an array manually.

For example if our object was described by the string representation

emp_1=given~Fred|surname~Smith|children~Mary~John~Martha|date_of_birth~1975-Feb-19 emp_2=given~Julie|surname~Brown|children~Luke|date_of_birth~1986-Jul-22

We might want to make emp_1 be a different person and we could do it as follows

var har = new Array();

har["given"] = "Louis";

har["surname"]="Wood";

har["children"]= new Array("Jim", "Mo");

objEmployees.Qiq_setObject("emp_1", har);

We might add a brand new object

objEmployees.Qiq_setObject("Our_Latest_and_greatest_employment_site", "New York City")

The result of these two method calls would result in the following serialized object

emp_1=given~Louis|surname~Wood|children~Jim~Mo emp_2=given~Julie|surname~Brown|children~|date_of_birth~1986-Jul-22 Our_Latest_and_greatest_employment_site=New York City

Parameters
in_strKey

The key for this row of properties

in_harObject

A hashed array of property keys and values.


void Qiq_setProperty( String in_strObjKey, String in_strPropKey, Object in_propertyValue )
Defined in Globals_EIS.cbtPropertyList.OnClick

This method sets the value or values of an object's property. Old values are lost and are replaced by the new value

For example if our object was described by the string representation

emp_1=given~Fred|surname~Smith|children~Mary~John~Martha|date_of_birth~1975-Feb-19 emp_2=given~Julie|surname~Brown|children~Luke|date_of_birth~1986-Jul-22

We might register the birth of Fred Smith's his new son Joe by the following call

objEmployees.Qiq_setProperty("emp_1", "children", new Array("Mary", "John", "Martha", "Joe"))

We might correct Julie Brown's errorneously recorded birthday by saying

objEmployees.Qiq_setProperty("emp_2", "date_of_birth", "1985-May-17")

Parameters
in_strObjKey

The key of the object

in_strPropKey

The key of the property

in_propertyValue

The String, Integer, or Boolean value where a single value is to be set, or an Array of values where more than one value is to be set


String Qiq_toString( Boolean in_blnPartialEscape )
Defined in Globals_EIS.cbtPropertyList.OnClick

Serializes the object - this is the opposite of what the constructor does. THis method is most often used to make a in-memory object persistent by writing it out to a text label

Parameters
in_blnPartialEscape

Optional, true if you only want the seperator values escaped (in_blnEscaped must also be true)

Return value
String