Difference between revisions of "Resource searchByName"

From Catglobe Wiki
Jump to: navigation, search
(Examples)
(Examples)
Line 25: Line 25:
 
<source lang="javascript">
 
<source lang="javascript">
 
string ResourceNamePattern = "phong";
 
string ResourceNamePattern = "phong";
 
 
number ResourceType = 10; // or ResourceType = Resource_Type_Report;
 
number ResourceType = 10; // or ResourceType = Resource_Type_Report;
 
 
number ResourceTempRID = 0;
 
number ResourceTempRID = 0;
 +
number SearchType = 1;  // or SearchType = NAME_SEARCH_TYPE_ANYWHERE;
  
number SearchType = 1; // or SearchType = NAME_SEARCH_TYPE_ANYWHERE;
+
Number SearchMaxcount= 3;
 +
array Result;
  
Number SearchMaxcount= 1;
+
Result = Resource_searchByName(ResourceNamePattern, ResourceType, ResourceTempRID, SearchType);
 +
print(Result.Count);
 +
print(Result);  
  
array Result = Resource_searchByName(ResourceNamePattern, ResourceType, ResourceTempRID, SearchType);
+
// 5 resources were found
 +
//{{10,37257205,Phong report 2,12,37246022,34409964},{10,37257212,Phong report 1,12,37246022,34409964},{10,37272405,phong report 3,12,37246022,34409964},{10,37272427,Phong report 4,12,37246022,34409964},{10,37272501,phong,12,37272491,34409964}}
  
 +
Result = Resource_searchByName(ResourceNamePattern, ResourceType, ResourceTempRID, SearchType, SearchMaxcount);
 +
print(Result.Count);
 
print(Result);  
 
print(Result);  
  
//{{10,37257205,Phong report 2,12,37246022,34409964},{10,37257212,Phong report 1,12,37246022,34409964},{10,37272405,phong report 3,12,37246022,34409964},{10,37272427,Phong report 4,12,37246022,34409964},{10,37272501,phong,12,37272491,34409964}}
+
// 3 resources were found
 +
//{{10,37257205,Phong report 2,12,37246022,34409964},{10,37257212,Phong report 1,12,37246022,34409964},{10,37272405,phong report 3,12,37246022,34409964}}
 +
 
 
</source>
 
</source>

Revision as of 10:58, 21 December 2011

Resource_searchByName


Search resources by name.

Syntax

Resource_searchByName(ResourceName, ResourceType, ResourceTemplateResourceID, SearchType, SearchMaxCount)

Arguments

  • ResourceName: is a string. It is the pattern of name of resource which user want to look up.
  • ResourceType: is a value of Resource type constants. Or we can also use the name of Resource type constants.
  • ResourceTemplateResourceID: is a number. It is the resource id of resource template ID. This value can be set 0 if don't care which template to search for.
  • SearchType: is a number. It's the value of the Search type constants. Or we can aslo use the name of the Search type constants.
  • SearchMaxCount: is a number.

Return type

An array, which contain the information of resources that match the search pattern.

Examples

string ResourceNamePattern = "phong";
number ResourceType = 10; // or ResourceType = Resource_Type_Report;
number ResourceTempRID = 0;
number SearchType = 1;  // or SearchType = NAME_SEARCH_TYPE_ANYWHERE;

Number SearchMaxcount= 3;
array Result;

Result = Resource_searchByName(ResourceNamePattern, ResourceType, ResourceTempRID, SearchType); 
print(Result.Count);
print(Result); 

// 5 resources were found
//{{10,37257205,Phong report 2,12,37246022,34409964},{10,37257212,Phong report 1,12,37246022,34409964},{10,37272405,phong report 3,12,37246022,34409964},{10,37272427,Phong report 4,12,37246022,34409964},{10,37272501,phong,12,37272491,34409964}}

Result = Resource_searchByName(ResourceNamePattern, ResourceType, ResourceTempRID, SearchType, SearchMaxcount); 
print(Result.Count);
print(Result); 

// 3 resources were found
//{{10,37257205,Phong report 2,12,37246022,34409964},{10,37257212,Phong report 1,12,37246022,34409964},{10,37272405,phong report 3,12,37246022,34409964}}