Difference between revisions of "AxisOption class"

From Catglobe Wiki
Jump to: navigation, search
Line 7: Line 7:
 
|Description=<nowiki>Create new axis option</nowiki>}}
 
|Description=<nowiki>Create new axis option</nowiki>}}
 
|Methods=
 
|Methods=
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>AddAccessGroup</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>groupResourceId</nowiki>|Description=<nowiki>Group to give access</nowiki>}}
 +
|Description=<nowiki>Add a new group that has access to this option.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>AddTag</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>AddTag</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>tag</nowiki>|Description=<nowiki>Tag to work on</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>tag</nowiki>|Description=<nowiki>Tag to work on</nowiki>}}
 
|Description=<nowiki>Add a new tag, a tag cannot contain whitespace. Return false if already added</nowiki>}}
 
|Description=<nowiki>Add a new tag, a tag cannot contain whitespace. Return false if already added</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Contains</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=object|Name=<nowiki>element</nowiki>|Description=<nowiki>Element to check for</nowiki>}}
 +
|Description=<nowiki>Return true if the array contains the element using the normal equal operator.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Except</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=array|Name=<nowiki>elements</nowiki>|Description=<nowiki>Elements to remove</nowiki>}}
 +
|Description=<nowiki>Return all elements that does not exist in the other collection.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>First</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A function to test each element for a condition.</nowiki>}}
 +
|Description=<nowiki>Returns the first element in a sequence that satisfies a specified condition.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>FirstOrDefault</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A function to test each element for a condition.</nowiki>}}
 +
|Description=<nowiki>Returns the first element in a sequence that satisfies a specified condition or empty if not found.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=int|Name=<nowiki>Frequency</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=number|Name=<nowiki>number</nowiki>|Description=<nowiki>The number to search for</nowiki>}}
 +
|Description=<nowiki>Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>HasAccessGroup</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>groupResourceId</nowiki>|Description=<nowiki>AccessGroup to work on</nowiki>}}
 +
|Description=<nowiki>Return true if group is added</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>HasTag</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>HasTag</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>tag</nowiki>|Description=<nowiki>Tag to work on</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>tag</nowiki>|Description=<nowiki>Tag to work on</nowiki>}}
 
|Description=<nowiki>Return true if tag is added</nowiki>}}
 
|Description=<nowiki>Return true if tag is added</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsCharacterArray</nowiki>|Description=<nowiki>check if array is an array of characters</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsNumericArray</nowiki>|Description=<nowiki>check if array is an array of integer numbers</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>IsStringArray</nowiki>|Description=<nowiki>check if array is an array of string</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Array of numbers|Name=<nowiki>ListAccessGroups</nowiki>|Description=<nowiki>Return list of all added AccessGroups</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of strings|Name=<nowiki>ListTags</nowiki>|Description=<nowiki>Return list of all added tags</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Array of strings|Name=<nowiki>ListTags</nowiki>|Description=<nowiki>Return list of all added tags</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>OrderBy</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>comparer</nowiki>|Description=<nowiki>Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.</nowiki>}}
 +
|Description=<nowiki>Sorts the elements of a sequence in ascending order by using a specified comparer.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Randomize</nowiki>|Description=<nowiki>Randomize the order of the elements in the current array.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>RemoveAccessGroup</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>groupResourceId</nowiki>|Description=<nowiki>AccessGroup to work on</nowiki>}}
 +
|Description=<nowiki>Remove a group.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>RemoveTag</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>RemoveTag</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>tag</nowiki>|Description=<nowiki>Tag to work on</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>tag</nowiki>|Description=<nowiki>Tag to work on</nowiki>}}
 
|Description=<nowiki>Remove a tag. Return false if not added</nowiki>}}
 
|Description=<nowiki>Remove a tag. Return false if not added</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Select</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A transform function to apply to each element.</nowiki>}}
 +
|Description=<nowiki>Projects each element of a sequence into a new form.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>SelectMany</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>selector</nowiki>|Description=<nowiki>A transform function to get each sub array.</nowiki>}}
 +
|Description=<nowiki>Projects each array element of a sequence into a new form.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>this[] { set; }</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>this[] { set; }</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
 
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Skip</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>n</nowiki>|Description=<nowiki>How many elements to skip</nowiki>}}
 +
|Description=<nowiki>Get all but the n first elements.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Take</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>n</nowiki>|Description=<nowiki>How many elements to take</nowiki>}}
 +
|Description=<nowiki>Get the n first elements.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ToDictionary</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>keySelector</nowiki>|Description=<nowiki>A transform function to get the key of each element.</nowiki>}}
 +
|Description=<nowiki>Return a dictionary with the elements of the array.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Dictionary|Name=<nowiki>ToDictionary</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>keySelector</nowiki>|Description=<nowiki>A transform function to get the key of each element.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=Function|Name=<nowiki>valueSelector</nowiki>|Description=<nowiki>A transform function to get the value of each element.</nowiki>}}
 +
|Description=<nowiki>Return a dictionary with the elements of the array.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>Where</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=Function|Name=<nowiki>predicate</nowiki>|Description=<nowiki>A function that takes 1 parameter of the types in the array and return true/false</nowiki>}}
 +
|Description=<nowiki>Filters a sequence of values based on a predicate.</nowiki>}}
 
|Properties=
 
|Properties=
 +
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Average</nowiki>|HasGetter=1|Description=<nowiki>Average of the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=Color|Name=<nowiki>Color</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Color for this option</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=Color|Name=<nowiki>Color</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Color for this option</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Expression</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Expression (nominator)</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Expression</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Expression (nominator)</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasAccess</nowiki>|HasGetter=1|Description=<nowiki>Get if current logged in user has access (Voluntary access control, doesn't check inheritance, if no groups defined this returns true)</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>LocalizedNames</nowiki>|HasGetter=1|Description=<nowiki>Get/set localized Name (title)</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>LocalizedNames</nowiki>|HasGetter=1|Description=<nowiki>Get/set localized Name (title)</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Name (title)</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Max</nowiki>|HasGetter=1|Description=<nowiki>Largest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Min</nowiki>|HasGetter=1|Description=<nowiki>Smallest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set default language name (title)</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>PctBase</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Percentage base (denominator). If empty then inherit from Axis</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>PctBase</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set Percentage base (denominator). If empty then inherit from Axis</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Sum</nowiki>|HasGetter=1|Description=<nowiki>Sum of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}

Revision as of 03:20, 9 August 2018

AxisOption



Represents an axis option in an axis.

Constructors

Methods

  • Empty AddAccessGroup(int groupResourceId "Group to give access") - Add a new group that has access to this option.
  • bool AddTag(string tag "Tag to work on") - Add a new tag, a tag cannot contain whitespace. Return false if already added
  • bool Contains(object element "Element to check for") - Return true if the array contains the element using the normal equal operator.
  • array Except(array elements "Elements to remove") - Return all elements that does not exist in the other collection.
  • object First(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition.
  • object FirstOrDefault(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition or empty if not found.
  • int Frequency(number number "The number to search for") - Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number
  • object this[] { get; }(int index "Index") - Backward-compatible indexer
  • bool HasAccessGroup(int groupResourceId "AccessGroup to work on") - Return true if group is added
  • bool HasTag(string tag "Tag to work on") - Return true if tag is added
  • bool IsCharacterArray() - check if array is an array of characters
  • bool IsNumericArray() - check if array is an array of integer numbers
  • bool IsStringArray() - check if array is an array of string
  • Array of number ListAccessGroups() - Return list of all added AccessGroups
  • Array of string ListTags() - Return list of all added tags
  • array OrderBy(Function comparer "Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.") - Sorts the elements of a sequence in ascending order by using a specified comparer.
  • Empty Randomize() - Randomize the order of the elements in the current array.
  • Empty RemoveAccessGroup(int groupResourceId "AccessGroup to work on") - Remove a group.
  • bool RemoveTag(string tag "Tag to work on") - Remove a tag. Return false if not added
  • array Select(Function selector "A transform function to apply to each element.") - Projects each element of a sequence into a new form.
  • array SelectMany(Function selector "A transform function to get each sub array.") - Projects each array element of a sequence into a new form.
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
  • array Skip(int n "How many elements to skip") - Get all but the n first elements.
  • array Take(int n "How many elements to take") - Get the n first elements.
  • Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.") - Return a dictionary with the elements of the array.
  • Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.", Function valueSelector "A transform function to get the value of each element.") - Return a dictionary with the elements of the array.
  • string ToString() - The string representation of the object.
  • array Where(Function predicate "A function that takes 1 parameter of the types in the array and return true/false") - Filters a sequence of values based on a predicate.

Properties

  • number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
  • Color Color { get; set; } - Get/set Color for this option
  • string Expression { get; set; } - Get/set Expression (nominator)
  • bool HasAccess { get; } - Get if current logged in user has access (Voluntary access control, doesn't check inheritance, if no groups defined this returns true)
  • LocalizedString LocalizedNames { get; } - Get/set localized Name (title)
  • number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
  • number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
  • string Name { get; set; } - Get/set default language name (title)
  • string ObjectTypeName { get; } - The name of the type of object.
  • string PctBase { get; set; } - Get/set Percentage base (denominator). If empty then inherit from Axis
  • number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

New Axis option

DataCacheSpecification dcs = new DataCacheSpecification(15636760);
Axis axis = new Axis (dcs, "Gender", "Your Gender");
axis.MathBase = "Gender";
axis.PctBase = "Gender!=empty";
axis.AddOption(new AxisOption(dcs, "Male", "Gender == [1]"));
axis.AddOption(new AxisOption(dcs, "Female", "Gender == [2]"));
axis.AddToAxisSet();
dcs.Save();

Update option

DCS_use(15636760);
Axis axis = AxisSet_getAxis("Gender");
array options = axis.Options;
for(number i=0; i<options.Count; i++)
{
	AxisOption option = options[i];
	option.PctBase = "Gender != empty";
}
AxisSet_save();