Difference between revisions of "Resource getResourceProperties"

From Catglobe Wiki
Jump to: navigation, search
 
Line 1: Line 1:
[[Category:Resource_Functions]]
+
{{HelpFiles}}
{{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>
 +
 
 +
|}
  
==Resource_getResourceProperties==
+
'''Example'''
  
Get all properties' values of a resource
+
array properties = Resource_getResourceProperties(15543655);
  
'''Syntax'''
+
number i;
  
Resource_getResourceProperties(''resourceId'')
+
number n = arrayCount(properties);
  
'''Arguments'''
+
for (i = 0; i &lt;n; i = i + 1)
  
* ''resourceId'': is a ''number ''expression, it is the resource's unique id
+
{
  
'''Return value'''
+
if (properties[i][RESOURCE_PROPERTY_TYPE] == RESOURCE_PROPERTY_TYPE_SINGLE)
  
An ''array ''of arrays, it is an array of property objects, which contains the following items
+
//set the first option selected
<table width="875" cellspacing="0" cellpadding="2" border="1" style="border-collapse:collapse; border:1px solid #010101" class="tableintopic">
 
<tbody><tr align="left" valign="top">
 
<td width="292" bgcolor="#C0C0C0" style="border:1px solid #010101;"><p class="bodytext"><strong class="specialbold">Index</strong></p>
 
</td>
 
<td width="292" bgcolor="#C0C0C0" style="border:1px solid #010101;"><p class="bodytext"><strong class="specialbold">Data type</strong></p>
 
</td>
 
<td width="292" bgcolor="#C0C0C0" style="border:1px solid #010101;"><p class="bodytext"><strong class="specialbold">Value</strong></p>
 
</td>
 
</tr>
 
<tr align="left" valign="top">
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">RESOURCE_PROPERTY_TYPE</span></p>
 
</td>
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">number</span></p>
 
</td>
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">Type of the property, it has value among the predefined constants:</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_BOOLEAN</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_DATETIME</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_MULTI</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_NUMBER</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_SINGLE</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_STRING</span></p>
 
<p class="bodytext"><span class="normalise">- RESOURCE_PROPERTY_TYPE_RESOURCE</span></p>
 
</td>
 
</tr>
 
<tr align="left" valign="top">
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">RESOURCE_PROPERTY_NAME</span></p>
 
</td>
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">string</span></p>
 
</td>
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">Name</span></p>
 
</td>
 
</tr>
 
<tr align="left" valign="top">
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">RESOURCE_PROPERTY_VALUE</span></p>
 
</td>
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">dependent on property type</span></p>
 
</td>
 
<td width="292" style="border:1px solid #010101;"><p class="bodytext"><span class="normalise">Value</span></p>
 
</td>
 
</tr>
 
  
</tbody></table>
+
properties[i][RESOURCE_PROPERTY_VALUE] = 1;
  
 +
}
  
 +
Resource_resourcePropertiesSave(15543655, properties);<br>
  
 +
<br> '''Availability'''
  
'''Availability'''
+
Version 5.6 __NOTOC__ <!-- imported from file: 6278.htm-->
  
Version 5.6
+
[[Category:Resource_Functions]]
__NOTOC__
 
<!-- imported from file: 6278.htm-->
 

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