Difference between revisions of "Resource searchByChildResourceIdAndResourceType"
Nguyenduyan (talk | contribs) (→Return type) |
(→Example) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
= Resource_searchByChildResourceIdAndResourceType = | = Resource_searchByChildResourceIdAndResourceType = | ||
− | + | Search all parents of resources which matching with given resource type | |
== Syntax == | == Syntax == | ||
Line 12: | Line 12: | ||
array ''resourceRId'' | array ''resourceRId'' | ||
− | number ''resourceType'' | + | number ''resourceType''. It's resource type constant. See more at [[CGS_Constants_list#Resource_type_constant]] |
== Return type == | == Return type == | ||
− | Dictionary | + | Dictionary. |
+ | |||
+ | Dictionary keys are the given resource ids | ||
+ | |||
+ | Dictionary values are array parents of the given resource id matching with given resource type | ||
+ | |||
+ | Each parent has following format: (same format returned when using [[Resource_searchByName]]) | ||
+ | |||
+ | RESOURCE_RESOURCE_ID : Rid of resource | ||
+ | RESOURCE_NAME : Name of resource | ||
+ | RESOURCE_TYPE : Type of resource | ||
+ | RESOURCE_PARENT_RESOURCE_ID : Rid of parent resource | ||
+ | RESOURCE_TEMPLATE_RESOURCE_ID : Rid of resource template | ||
== Example == | == Example == | ||
<source lang="javascript"> | <source lang="javascript"> | ||
− | |||
array resourceId={15600608, 15601655, 15601668}; | array resourceId={15600608, 15601655, 15601668}; | ||
− | number resourceType = 6; | + | number resourceType = 6;//Resource_Type_Folder ; |
− | + | //return all parent type folder of resource 15600608, 15601655, 15601668 | |
+ | Dictionary result = Resource_searchByChildResourceIdAndResourceType( resourceId, resourceType); | ||
print(result); | print(result); | ||
− | / | + | /* |
− | + | { | |
+ | "15600608": {{10,15559701,BUS 2017,6,75733,2071},{10,75733,Survey,6,75732,2071},{10,75732,Omnibus,6,6376,2071}}, | ||
+ | "15601655": {}, | ||
+ | "15601668": {{10,15588464,Qnaire Send Email,6,15563252,2071},{10,15563252,CG1876vox,6,2126,2071}} | ||
+ | } | ||
+ | */ | ||
</source> | </source> |
Latest revision as of 07:45, 22 August 2018
Contents
Resource_searchByChildResourceIdAndResourceType
Search all parents of resources which matching with given resource type
Syntax
Resource_searchByChildResourceIdAndResourceType(array resourceRId, number resourceType);
Arguments
array resourceRId
number resourceType. It's resource type constant. See more at CGS_Constants_list#Resource_type_constant
Return type
Dictionary.
Dictionary keys are the given resource ids
Dictionary values are array parents of the given resource id matching with given resource type
Each parent has following format: (same format returned when using Resource_searchByName)
RESOURCE_RESOURCE_ID : Rid of resource RESOURCE_NAME : Name of resource RESOURCE_TYPE : Type of resource RESOURCE_PARENT_RESOURCE_ID : Rid of parent resource RESOURCE_TEMPLATE_RESOURCE_ID : Rid of resource template
Example
array resourceId={15600608, 15601655, 15601668};
number resourceType = 6;//Resource_Type_Folder ;
//return all parent type folder of resource 15600608, 15601655, 15601668
Dictionary result = Resource_searchByChildResourceIdAndResourceType( resourceId, resourceType);
print(result);
/*
{
"15600608": {{10,15559701,BUS 2017,6,75733,2071},{10,75733,Survey,6,75732,2071},{10,75732,Omnibus,6,6376,2071}},
"15601655": {},
"15601668": {{10,15588464,Qnaire Send Email,6,15563252,2071},{10,15563252,CG1876vox,6,2126,2071}}
}
*/