Page tree
Skip to end of metadata
Go to start of metadata

EWSearchTable

Executes a pre-configured named Saved Search against the specified table and returns and array of record data for the records that match the search.

Syntax

 EWWSBaseUserObject[] os = ew.EWSearchTable(String sessionId, String
              tableName, String[] fieldNames, String searchName);

Usage

Use the EWSearchTable call to search for records in the specified table based on a Saved Search pre-configured in the GUI.

Rules and Guidelines

When querying records, consider the following rules and guidelines:

  • The username that was used to obtain the specified session token must have sufficient access rights to read individual records within the specified table. Please verify specific permissions via Setup > Access > Manage Groups > (Edit Group) > Table > (Select Table) > Permissions.
  • Agiloft allows specifying fine-grained access permissions on the field level. The username that was used to obtain the specified session token must have sufficient access rights to be able to read field content. Please verify specific permissions via Setup > Access > Manage Groups  > (Edit Group) > Table > (Edit Table) > Field Permissions.
  • This call does not return records that have been deleted.
  • This method never returns null. In the case when no records are found an empty array is returned.
  • Special note on memory management: As WS integration implies pass-by-value semantics, the memory allocated for the resulting array will be released once the data is sent to the client and server-side JVM's garbage collector considers it eligible for discarding.
  • If the client-side environment is the one with a garbage collector, the memory used by client-side array will be cleared once the client-side garbage collector considers it eligible.
  • When the client environment uses explicit memory management, the client is responsible for freeing up the used memory explicitly.
  • When using the EWSearchTable method, only the fields explicitly listed in the call are read. Within the values returned for the fields requested explicitly, a null value, where nillable="true", means the actual null value was retrieved.  However, the rest of the fields – those not listed in the fieldNames array – will also appear on the wire as nillable="true" elements due to limitations of the underlying Web Services stack.
  • To read all fields, use "*" string constant as the only element in the fieldNames array.

Linked Fields

Values for the fields that are imported into the target table from the donor table as a part of a Linked Fields set are available via special linking classes.

In WSDL a Linked Fields set takes form of a DAO_Dao3_Link<N> field in the complex data structure that corresponds to the target table, where N is a sequential number assigned automatically at the time of the set creation (e.g. WSCase.DAO_Dao3_Link3).

As a value such fields can take one or more WS<Table1><Table2>_Dao3_Link<N> data structures - linking classes, where Table1 is the target table and Table2 is the donor table of the Linked Fields relationship, for example WSCaseTeams_Dao3_Link3.

Unfortunately, at this moment one has to rely on investigating the actual sets of fields inside the classes to trace the fields, which are visible in the Field Wizard in the GUI, back to the main object property which is not visible in the GUI.

Non-source values for Linked Field sets that allow them are present directly in the table itself and additionally to those in the Linking Classes, if the link was in fact forged.

Choice Fields

The values for choice columns are returned as instances of the enumerated types described in the WSDL.

The original text values have undergone the following transformations:

  1. Spaces replaced by "_"
  2. Dashes replaced by "MINUS"
  3. Pluses replaced by "PLUS"
  4. Prefixed with "OPTION_"
  5. Converted to Upper Case

One has to perform the reverse transformation to get to the text value.

Unsupported Types of Fields

Related tables and embedded search results are not supported by the SOAP interface.

Basic Steps for Searching Records with a Pre-configured Saved Search

  1. Create a Saved Search in the GUI.
  2. Perform the call using the name of the search as the last parameter.
  3. Handle the results, specifically the situations where there are no elements, one element, or more than one element in the returned array.

Example Task

In MyKB knowledgebase, as user A, find all cases assigned to the user used to login. Return summaries as a String array.

The task is completed by performing the following steps:

  1. Login to MyKB with "A" and "password" and English as the local language.
  2. Search for cases using My Assigned search.
  3. Logout.

Sample Code - Java

You can generate sample Web Services code for any table by selecting Setup > Tables > (Edit Table) > API > Download Sample.

 public String[] search() throws Exception {
              EWServiceAPI binding = new EWServiceAPIServiceLocator().getDemo();
              try {
              String sessionId = binding.EWLogin("MyKB", "A", "password", "en");
              EWWSBaseUserObject[] records = binding.EWSearchTable(sessionId, "case",
              new String[] {"summary"}, "My Assigned");
              String[] result = new String[records.length];
              for (int i=0; i<records.length; i++) {
              result[i] = records[i].getSummary();
              }
              return result;
              } finally {
              binding.EWLogout(sessionId);
              }
              }

Arguments

Name

Type

Description

sessionId

String

Session token.

tableName

String

The name of the table where the query has to be performed.

fields

String array

The list of fields to read.

savedsearch

String

The name of the Saved Search to run.

Response

An array of the records as descendants of EWWSBaseUserObject - a complex structure described in WSDL.

Faults

EWSessionException - client not logged in or the session has expired; client should re-login.

EWPermissionException - user used to create the session lacks the sufficient privileges to run the query.

EWWrongDataException - client has supplied the wrong data.

EWOperationException - the operation has been blocked by an Agiloft function, for example a table-level lock.

EWIntegrityException - specified table cannot be found or its primary key cannot be identified.

EWUnexpectedException - an unexpected exception has occurred; the admin user should report this for investigation.