Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
Avoiding the use of the for…in loop over an array
When tailoring HPE Service Manager, you often need to iterate over an array. However, using a for…in
loop to iterate over an array may return unexpected results, particularly, in the two scenarios illustrated below. HPE recommends that you use the for ([initialization]; [condition]; [final-expression])
loop instead when iterating over an array object.
Service Manager currently uses a JavaScript Engine that complies with JavaScript 1.5, in which some Array.prototype
functions are implemented as built-in functions. When enhancing an array object with a custom method, the for...in
loop iterates on all items in the array including the custom method. Similar issue also occurs to customized Array.prototype
functions, as demonstrated in the following example code and its output. This behavior might lead to errors that are difficult to debug.
Array.prototype._prototypeFunction = function() { // prototype function will be iterated as non built-in property print('prototype element'); } print(‘built-in property: ‘ + array.length); // length is built-in property of array object, it will not be iterated within for…in statement for(var item in [1]) { print(‘ non built-in properties of Array type:’ + item); //iterate the non built-in properties }
Output:
non built-in property of Array type: _prototypeFunction // prototype function added as non built-in non built-in property of Array type: 0 built-in property: 4
In this situation, you can use a guarding if
statement to help debug the code.
For example:
if (<array> .hasOwnProperty(<item index>))
or
if (typeof(<array>[<item index>]!="function")
The for…in
loop iterates objects in an order according to the ASCII values of the property names. Do not use the for…in
loop to iterate over an array when the index order is important. See the following example code and its output.
var array = [1,2,3]; array[‘_’] = ‘test’; // interrupting element array[10] = 10; for(var item in array) { print(‘ non built-in properties of Array type:’ + item); //iterate the non built-in properties }
Output:
non built-in property of Array type : 10 // Missing index 3~9! non built-in property of Array type: _ //interrupt the element index order non built-in property of Array type: 2 non built-in property of Array type: 1 non built-in property of Array type: 0
For more information about using the for...in
statement, refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in.
We welcome your comments!
To open the configured email client on this computer, open an email window.
Otherwise, copy the information below to a web mail client, and send this email to ovdoc-ITSM@hp.com.
Help Topic ID:
Product:
Topic Title:
Feedback: