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...
| Type | Name |
|---|---|
| void | Qiq_deleteObject( String in_strObjKey ) Deletes an object from the collection |
| void | Qiq_deleteProperty( String in_strObjKey, String in_strPropKey ) Deletes a second level property from the collection |
| void | Qiq_getCollection( Shape in_list ) Adds the list of keys in the collection of objects to the list box or drop-down |
| HashedArray | Qiq_getKeys() Returns a hashed array of the keys in this Qiq_property object |
| HashedArray | Qiq_getObject( String in_strKey ) Returns the object as an hashed Array of property keys that reference an array of associated values |
| Array | Qiq_getProperties( String in_strObjKey, String in_strPropKey ) Returns a property value that is an array |
| String | Qiq_getProperty( String in_strObjKey, String in_strPropKey ) Returns a string property value. |
| Boolean | Qiq_getPropertyAsBoolean( String in_strObjKey, String in_strPropKey ) Returns a Boolean property value. |
| Integer | Qiq_getPropertyAsInteger( String in_strObjKey, String in_strPropKey ) Returns an integer property value. |
| String | Qiq_property( String 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 |
| void | Qiq_setObject( String 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. |
| void | Qiq_setProperty( String 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 |
| String | Qiq_toString( Boolean 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 |
Deletes an object from the collection
| in_strObjKey |
The key of the object to be deleted |
Deletes a second level property from the collection
| in_strObjKey |
The key of the object to be deleted |
| in_strPropKey |
The key of the property to be deleted |
Adds the list of keys in the collection of objects to the list box or drop-down
| in_list |
List box or drop-down to return the object keys into |
Returns a hashed array of the keys in this Qiq_property object
| HashedArray |
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.
| in_strKey |
the key of the object of interest |
| HashedArray |
Returns a property value that is an array
| in_strObjKey |
The 1st level key (the word before '=') |
| in_strPropKey |
The 2nd level key (the word before '~') |
| Array |
of values (or an empty array if there is no such property value) |
Returns a string property value.
| in_strObjKey |
The 1st level key (the word before '=') |
| in_strPropKey |
The 2nd level key (the word before '~') |
| String |
The property value |
Returns a Boolean property value.
| in_strObjKey |
The 1st level key (the word before '=') |
| in_strPropKey |
The 2nd level key (the word before '~') |
| Boolean |
The property value |
Returns an integer property value.
| in_strObjKey |
The 1st level key (the word before '=') |
| in_strPropKey |
The 2nd level key (the word before '~') |
| Integer |
The property value, NaN if Qiq_getProperty is invalid |
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
| 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 |
| String |
Only if there is an error message |
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
| in_strKey |
The key for this row of properties |
| in_harObject |
A hashed array of property keys and values. |
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")
| 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 |
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
| in_blnPartialEscape |
Optional, true if you only want the seperator values escaped (in_blnEscaped must also be true) |
| String |