Resource getResourceProperties

From Catglobe Wiki
Revision as of 04:06, 26 December 2011 by Cg pham (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



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