Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%iKnow] >  [Queries] >  [Utils]
Private  Storage   

class %iKnow.Queries.Utils extends %RegisteredObject

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

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
4


Summary

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
DumpQueryResult GetParameterDisplayName GetParameterValues GetQueryResultColumns


Methods

• 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.



Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.