JavaScript method: SCFile/SCDatum.getText()

This method returns a text string representation of the current SCFile or SCDatum object. The text string has the following format:

table={["field value",{"array value","array value"},...]}

Syntax

SCFile_object.getText();
SCDatum_object.getText();

Arguments

There are no arguments for this method.

Return values

A string and RC_SUCCESS or one of the other global return code values.

The method returns a text string containing the current SCFile or SCDatum object and a global return code value of RC_SUCCESS, or returns one of the error global return code values if the method cannot return a string.

Example

This example does the following:

  • Searches the contacts table for any contact name you define in the search variable
  • Displays the contact record as a text string

This example requires the following sample data:

  • A valid contact name (for example, "ADMINISTRATOR, SYSTEM")
  • A invalid contact name (for example, "NOT A, CONTACT")
var contactName;

function findContactName( name )
{
 print( "Searching for contact: " + name + "..." );
 var contactList = new SCFile( "contacts" );
 var findContact = contactList.doSelect( "contact.name=\""+ name + "\"" )
 if ( findContact == RC_SUCCESS )
 {
  print( "Success. found " + name + " in contact record:\n" + contactList.getText() );
  return contactList
 }
 else
 {
  print( "Could not find contact. " + RCtoString( findContact ) );
  return null
 }
}

contactName = "ADMINISTRATOR, SYSTEM";
findContactName( contactName );

contactName = "NOT A, CONTACT";
findContactName( contactName );