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 |
|
- JavaScript object: SCFile
- JavaScript method: SCFile.deleteAttachment( attachID )
- JavaScript method: SCFile.deleteAttachments()
- JavaScript method: SCFile.doAction()
- JavaScript method: SCFile.doCount()
- JavaScript method: SCFile.doDelete()
- JavaScript method: SCFile.doInsert()
- JavaScript method: SCFile.doPurge()
- JavaScript method: SCFile.doRemove()
- JavaScript method: SCFile.doSave()
- JavaScript method: SCFile.doSelect()
- JavaScript method: SCFile.doUpdate()
- JavaScript method: SCFile.getAttachment( attachID )
- JavaScript method: SCFile.getattachments()
- JavaScript method: SCFile.getBinary()
- JavaScript method: SCFile.getFirst()
- JavaScript method: SCFile.getLast()
- JavaScript method: SCFile.getLastRC()
- JavaScript method: SCFile.getMessages()
- JavaScript method: SCFile.getNext()
- JavaScript method: SCFile.getPrev()
- JavaScript method: SCFile.getPurgedRowCount()
- JavaScript method: SCFile.getText()
- JavaScript method: SCFile.getType()
- JavaScript method: SCFile.getXML()
- JavaScript method: SCFile.insertattachment()
- JavaScript method: SCFile.isRecord()
- JavaScript method: SCFile.setBinary()
- JavaScript method: SCFile.setFields()
- JavaScript method: SCFile.setOrderBy()
- JavaScript method: SCFile.setRecord()
- JavaScript method: SCFile.updateAttachment( attachObj )
JavaScript method: SCFile.setFields()
This method causes any subsequent doSelect() calls to fetch only the specified fields. If setFields has not been called on a table, all fields are selected and a “SELECT *” is performed.
This method is supported for read-only objects. You can make an object read-only specifying the SCFILE_READONLY
argument in the SCFile constructor.
Calling setFields with no parameters will reset any previously specified fields. Any subsequent calls to doSelect() will fetch all fields (a SELECT * will be performed).
Note Do not reference fields in the object that have not been specified in the setFields method. If you reference field in the object that has not been specified in the setFields method, the field appears as “null” whether the database has data in that column or not.
Syntax
SCFile_object.setFields( field-array );
SCFile_object.setFields( field-string );
SCFile_object.setFields( );
Arguments
The following arguments are valid for this method:
Argument | Data type | Description |
---|---|---|
field-array
|
Array | A javascript array of field name strings; for example, setFields(new Array(“contact.name”, “user.id”)) . |
field-string
|
String | A string of space-separated field names; for example, setFields(“contact.name user.id”) . |
Return values
The method returns RC_SUCCESS
if successful and RC_ERROR
on failure.
The following conditions cause a setFields failure:
- Calling setFields on an uninitialized SCFile or a non read-only SCFile
- Calling setFields with an invalid argument type (not a string or an array of strings)
- Calling setFields with one (or more) invalid fields. (The method performs a basic validation on the field names to ensure they exist in the DBDICT.)
When the method fails, it has no effect, and the last successful call to setFields stays in effect. It issues a warning in the sm.log file.
Limitations
- The main unique key fields of the dbdict are always selected from the table (and for join tables, from each underlying table) even if not explicitly specified in setFields.
-
Since only basic field validation is performed in the setFields method, there are certain situations when the call can be successful (returns
RC_SUCCESS
) but a “SELECT *” is still performed.This would be the case if:
- All specified fields exist in the DBDICT but at least one field is an alias field, a structure name or an unmapped field (which are unsupported).
- LDAP is the primary data source for the table. (LDAP mapped fields are supported as long as LDAP is not the primary data source.)
Example usage
This example does the following:
- Takes the prefix of a contact name and returns a list of contacts that start with the specified prefix.
- On failure, returns the message "Could not find contact."
This example requires the following sample data:
- a contacts table with some records
function findPrefix( prefix ) { var contactList = new SCFile( "contacts", SCFILE_READONLY ); //added new parameter SCFILE_READONLY var fields = new Array("contact.name", "user.id"); // build array of fields to be returned from DB var rc = contactList.setFields( fields ); // call new setFields method to identify fields to query from DB if ( rc != RC_SUCCESS ) { print( "setFields() failed, will revert to SELECT * (see log for more info)" ); return null; } var findContact = contactList.doSelect( "contact.name # \"" + prefix + "\"" ); if ( findContact == RC_SUCCESS ) { return contactList; } else { print( "Could not find contact. " + RCtoString( findContact ) ); return null; } }
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: