Difference between revisions of "Resource getResourceProperties"
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{HelpFiles}} | |
− | + | ||
+ | == Resource_getResourceProperties == | ||
+ | |||
+ | Get all properties' values of a resource | ||
+ | |||
+ | '''Syntax''' | ||
+ | |||
+ | Resource_getResourceProperties(''resourceId'') | ||
+ | |||
+ | '''Arguments''' | ||
+ | |||
+ | *''resourceId'': is a ''number ''expression, it is the resource's unique id | ||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | An ''array ''of arrays, it is an array of property objects, which contains the following items | ||
+ | |||
+ | |||
+ | |||
+ | {| width="875" cellspacing="0" cellpadding="2" border="1" style="border-collapse:collapse; border:1px solid #010101" class="tableintopic" | ||
+ | |- align="left" valign="top" | ||
+ | | width="292" bgcolor="#C0C0C0" style="border:1px solid #010101;" | | ||
+ | '''Index''' | ||
+ | |||
+ | | width="292" bgcolor="#C0C0C0" style="border:1px solid #010101;" | | ||
+ | '''Data type''' | ||
+ | |||
+ | | width="292" bgcolor="#C0C0C0" style="border:1px solid #010101;" | | ||
+ | '''Value''' | ||
+ | |||
+ | |- align="left" valign="top" | ||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">RESOURCE_PROPERTY_TYPE</span> | ||
+ | |||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">number</span> | ||
+ | |||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">Type of the property, it has value among the predefined constants:</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_BOOLEAN</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_DATETIME</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_MULTI</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_NUMBER</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_SINGLE</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_STRING</span> | ||
+ | |||
+ | <span class="normalise">- RESOURCE_PROPERTY_TYPE_RESOURCE</span> | ||
+ | |||
+ | |- align="left" valign="top" | ||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">RESOURCE_PROPERTY_NAME</span> | ||
+ | |||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">string</span> | ||
+ | |||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">Name</span> | ||
+ | |||
+ | |- align="left" valign="top" | ||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">RESOURCE_PROPERTY_VALUE</span> | ||
+ | |||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">dependent on property type</span> | ||
+ | |||
+ | | width="292" style="border:1px solid #010101;" | | ||
+ | <span class="normalise">Value</span> | ||
+ | |||
+ | |} | ||
− | + | '''Example''' | |
− | + | array properties = Resource_getResourceProperties(15543655); | |
− | + | number i; | |
− | + | number n = arrayCount(properties); | |
− | + | for (i = 0; i <n; i = i + 1) | |
− | + | { | |
− | + | if (properties[i][RESOURCE_PROPERTY_TYPE] == RESOURCE_PROPERTY_TYPE_SINGLE) | |
− | + | //set the first option selected | |
− | |||
− | + | properties[i][RESOURCE_PROPERTY_VALUE] = 1; | |
− | + | } | |
− | + | Resource_resourcePropertiesSave(15543655, properties);<br> | |
− | '' | + | <br> '''Availability''' |
− | + | Version 5.6 __NOTOC__ <!-- imported from file: 6278.htm--> | |
− | + | [[Category:Resource_Functions]] | |
− | |||
− |
Latest revision as of 04:06, 26 December 2011
Resource_getResourceProperties
Get all properties' values of a resource
Syntax
Resource_getResourceProperties(resourceId)
Arguments
- resourceId: is a number expression, it is the resource's unique id
Return value
An array of arrays, it is an array of property objects, which contains the following items
Index |
Data type |
Value |
RESOURCE_PROPERTY_TYPE |
number |
Type of the property, it has value among the predefined constants: - RESOURCE_PROPERTY_TYPE_BOOLEAN - RESOURCE_PROPERTY_TYPE_DATETIME - RESOURCE_PROPERTY_TYPE_MULTI - RESOURCE_PROPERTY_TYPE_NUMBER - RESOURCE_PROPERTY_TYPE_SINGLE - RESOURCE_PROPERTY_TYPE_STRING - RESOURCE_PROPERTY_TYPE_RESOURCE |
RESOURCE_PROPERTY_NAME |
string |
Name |
RESOURCE_PROPERTY_VALUE |
dependent on property type |
Value |
Example
array properties = Resource_getResourceProperties(15543655);
number i;
number n = arrayCount(properties);
for (i = 0; i <n; i = i + 1)
{
if (properties[i][RESOURCE_PROPERTY_TYPE] == RESOURCE_PROPERTY_TYPE_SINGLE)
//set the first option selected
properties[i][RESOURCE_PROPERTY_VALUE] = 1;
}
Resource_resourcePropertiesSave(15543655, properties);
Availability
Version 5.6