This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > %SYS namespace > %iKnow.Queries.Utils


class %iKnow.Queries.Utils extends %Library.RegisteredObject

Utility class grouping some utility and informative methods complementing the iKnow Query APIs.

Method Inventory (Including Private)

Methods (Including Private)

classmethod DumpQueryResult(pFilename As %String, pQueryClass As %String, pQueryName As %String, pQueryParams...) as %Status

This utility method executes a query of one of the primary iKnow query APIs (with the *API suffix), as identified by pQueryClass and pQueryName, and writes the output as a CSV file to pFilename. This will overwrite the output file if it already exists and the output will include a header line containing column names and types.

pQueryParams... is to contain all the parameters you would normally supply to the query, except for its ByRef result parameter, which is taken care of by this utility.

For example, a query defined as

User.MyAPI.GetXByY(ByRef result, domainId As %Integer, x As %String,
 y As %String)
will be called as follows:

do ##class(%iKnow.Queries.Utils).DumpQueryResult("C:\temp\myFile.csv", 
 "User.MyAPI", "GetXByY", domainId, x, y)
classmethod GetParameterDisplayName(paramName As %String) as %String

Returns a displayable name for most query parameter names in use. If no more readable form is available (for example if it's too trivial), paramName itself is returned.

classmethod GetParameterValues(paramName As %String, Output values, queryClass As %String = "", queryName As %String = "") as %Boolean

Returns a list of the possible parameter values for a number of common query parameters in a variable containing key-displayValue pairs: values(i) = $lb(key, value). The %Boolean returned expresses whether this is a known parameter for which a meaningful list of values can be returned.

The optional queryClass and queryName parameters will in some cases limit the possible values to the allowed ones supported by that particular query.

Note: for the "pageSize" parameter, this method will return a limited number of possible values to make this method more useful for internal purposes, but obviously any positive numeric value will do.

classmethod GetQueryResultColumns(queryClass As %String, queryName As %String, Output columns) as %Status

Returns a list of the columns returned by the query identified by the queryClass and queryName parameters in the following format: columns(index) = $lb(name,type). If the supplied parameters do not correspond to a known query, an error is returned.

Inherited Members

Inherited Methods (Including Private)