%ZEN.Auxiliary.jsonMDXProvider

class %ZEN.Auxiliary.jsonMDXProvider extends %ZEN.Auxiliary.altJSONProvider, %DeepSee.Component.pivotTable

A version of the JSON provider that can use an MDX query or the full name of a stored pivot table to supply data that is served to the client in JSON format. This can be used in the same manner as the jsonProvider component.
For example, placing this within your page definition:
<jsonMDXProvider id="mdxProvider" mdxQuery="SELECT FROM HOLEFOODS"/>
would cause the given MDX statement to execute when the page is requested and the results of the query to be written to the page in JSON format:
o.content = {
		"AxesInfo": {
		},
		"Info": {
			"ColCount":0,
			"Cube":"HOLEFOODS",
			"CubeKey":"HOLEFOODS",
			"Error": {
				"ErrorCode":"",
				"ErrorMessage":""
			},
			"ListingSource":"",
			"MDXText":"SELECT FROM HOLEFOODS",
			"QueryKey":"en558256763",
			"QueryType":"SELECT",
			"ResultsComplete":1,
			"RowCount":0,
			"TimeStamp":"2015-05-12 13:23:58"
		},
		"Result": {
			"Axes":[
			],
			"CellData":[ {
					"%ID":"Cell_1",
					"Format":"",
					"ValueFormatted":"1,000",
					"ValueLogical":1000
				}
			]
		}
	};
The JSON content object will contain three major branches AxesInfo, Info, and Result, each of which contain an array of objects that correspond to query structure, metadata, and actual results as returned by the MDX statement.
If you need more control over the MDX query, you can use the OnGetMDX callback method.
This component ignores all of the data source callback methods inherited from the jsonProvider class.

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties

property OnCreateResultSet as %ZEN.Datatype.delegator (FORMALSPEC = "*tSC:%Status,&pParms:%String", RETURNTYPE = "%DeepSee.ResultSet");
(optional) Name of Server-side callback method to call to create a %DeepSee.ResultSet object.
This must be the name of a server-only method in the page class that contains this component.
Property methods: OnCreateResultSetDisplayToLogical(), OnCreateResultSetGet(), OnCreateResultSetIsValid(), OnCreateResultSetLogicalToDisplay(), OnCreateResultSetLogicalToOdbc(), OnCreateResultSetNormalize(), OnCreateResultSetSet()
property OnExecuteResultSet as %ZEN.Datatype.delegator (FORMALSPEC = "pRS:%DeepSee.ResultSet,*tSC:%Status,&pParms:%String", RETURNTYPE = "%Boolean");
(optional) Name of Server-side callback method to call to execute the %DeepSee.ResultSet object.
This must be the name of a server-only method in the page class that contains this table pane.
Property methods: OnExecuteResultSetDisplayToLogical(), OnExecuteResultSetGet(), OnExecuteResultSetIsValid(), OnExecuteResultSetLogicalToDisplay(), OnExecuteResultSetLogicalToOdbc(), OnExecuteResultSetNormalize(), OnExecuteResultSetSet()
property OnGetMDX as %ZEN.Datatype.delegator (FORMALSPEC = "&pParameters:%String,&pMDX:%String,pCriteria:%ZEN.proxyObject,&pPagingInfo:%String", RETURNTYPE = "%Status");
This specifies a callback method that returns an MDX query (string) that will drive this provider. This is identical in behavior to (and replaces) the mdx property. The method can make it easier to create queries based on parameter values or search criteria passed via the criteria property.
Property methods: OnGetMDXDisplayToLogical(), OnGetMDXGet(), OnGetMDXIsValid(), OnGetMDXLogicalToDisplay(), OnGetMDXLogicalToOdbc(), OnGetMDXNormalize(), OnGetMDXSet()
property cubeKey as %ZEN.Datatype.string;
If defined along with queryKey, the provider can prepare a resultset of a query already in progress.
Property methods: cubeKeyDisplayToLogical(), cubeKeyGet(), cubeKeyIsValid(), cubeKeyLogicalToDisplay(), cubeKeyLogicalToOdbc(), cubeKeyNormalize(), cubeKeySet()
property mdxQuery as %ZEN.Datatype.string;
If defined, the provider can generate JSON results from MDX query text
Property methods: mdxQueryDisplayToLogical(), mdxQueryGet(), mdxQueryIsValid(), mdxQueryLogicalToDisplay(), mdxQueryLogicalToOdbc(), mdxQueryNormalize(), mdxQuerySet()
property pivotTable as %ZEN.Datatype.string;
If defined, the provider can generate JSON results from a stored pivot definition
Property methods: pivotTableDisplayToLogical(), pivotTableGet(), pivotTableIsValid(), pivotTableLogicalToDisplay(), pivotTableLogicalToOdbc(), pivotTableNormalize(), pivotTableSet()
property queryKey as %ZEN.Datatype.string;
If defined along with cubeKey, the provider can prepare a resultset of a query already in progress.
Property methods: queryKeyDisplayToLogical(), queryKeyGet(), queryKeyIsValid(), queryKeyLogicalToDisplay(), queryKeyLogicalToOdbc(), queryKeyNormalize(), queryKeySet()
property recordCount as %ZEN.Datatype.integer;
If the provider is using server-side data paging, this is the total number of records.
Property methods: recordCountDisplayToLogical(), recordCountGet(), recordCountIsValid(), recordCountLogicalToDisplay(), recordCountLogicalToOdbc(), recordCountNormalize(), recordCountSet()

Methods

method %ConstructNewDynamicArray() as %DynamicArray [ Language = objectscript ]
Constructor for a dynamic array.
method %ConstructNewDynamicObject() as %DynamicObject [ Language = objectscript ]
Constructor for a dynamic object.
method %Execute() as %Status [ Language = objectscript ]
Execute the MDX query or pre-defined pivot table
classmethod %ObjectToJSON(pObject As %RegisteredObject, ByRef pVisited, pLevel As %Integer = 0, pFormat As %String = "aeloqstw") as %Status [ Language = objectscript ]
Override this method for this provider to override the format and suppress the default inclusion of the class in the JSON output.
method %OnCreateResultSet(Output pRS As %DeepSee.ResultSet, ByRef pParms) as %Status [ Language = objectscript ]
This callback is invoked when a provider is about to create a result set.
If the callback creates a %DeepSee.ResultSet object and returns it via pRS, then the pivot table will use this result set to display results.
method %OnExecuteResultSet(pRS As %DeepSee.ResultSet, Output tSC As %Status, ByRef pParms) as %Boolean [ Language = objectscript ]
Internal method.
Subclasses can override this to execute the %ResultSet object used to by this component.
Return true (1) if the result set has been executed.
The default implementation is to call the page method specified by the onExecuteResultSet property, if defined.
private method %OnNew(initvalue As %RawString) as %Status [ Language = objectscript ]
Inherited description: Constructor for Zen objects.
If subclasses override %OnNew, they should make sure to invoke this using #super.
classmethod %StatusToDynamicObject(pStatus As %Status) as %RegisteredObject [ Language = objectscript ]
Convert a %Status object into an object that can be emitted as JSON
classmethod %WriteJSONFromMDX(pVar As %String = "", pMDX As %String, pReturnStatus As %Boolean = 0, tProvider As %ZEN.Auxiliary.jsonMDXProvider = "") as %String [ Language = objectscript ]
Utility method to allow direct use of JSON from a non-ZEN context (such as a CSP page).
The JSON notation is written out to the current device. pVar is the optional name of the client-side javascript variable that refers to the JSON notation.
pMDX is the MDX statement that is executed and provides the JSON content. Supported query types are SELECT, DRILLTHOUGH, DRILLFACTS.
From a CSP page, you could invoke the method as follows:
#(##class(%ZEN.Auxiliary.jsonMDXProvider).%WriteJSONFromMDX("json","SELECT NON EMPTY [Channel].[H1].[Channel Name].Members ON 0 FROM [HOLEFOODS]"))#
pReturnStatus controls whether the method will return the execution status. By default this is set to 0 to quit an empty string for compatibility with the #()# syntax.
tProvider allows parameters to be passed in by creating an instance of the jsonMDXProvider and passing it into the method. The value of pMDX will be ignored in this case.
classmethod %WriteJSONFromPivot(pVar As %String = "", pPivot As %String, pReturnStatus As %Boolean = 0, tProvider As %ZEN.Auxiliary.jsonMDXProvider = "") as %String [ Language = objectscript ]
Utility method to allow direct use of JSON from a non-ZEN context (such as a CSP page).
The JSON notation is written out to the current device. pVar is the optional name of the client-side javascript variable that refers to the JSON notation.
pPivot is the full name of a stored pivot that is executed and provides the JSON content.
From a CSP page, you could invoke the method as follows:
#(##class(%ZEN.Auxiliary.jsonMDXProvider).%WriteJSONFromPivot(,"Use In Dashboards/ProductInfo"))#
pReturnStatus controls whether the method will return the execution status. By default this is set to 0 to quit an empty string for compatibility with the #()# syntax.
tProvider allows parameters to be passed in by creating an instance of the jsonMDXProvider and passing it into the method. The value of pPivot will be ignored in this case.
classmethod %WriteJSONStreamFromMDX(ByRef pStream As %Stream.Object, pMDX As %String, pRewindStream As %Boolean = 0, tProvider As %ZEN.Auxiliary.jsonMDXProvider = "") as %Status [ Language = objectscript ]
Utility method to allow JSON output generated by the MDX query defined in pMDX to be written to the stream supplied in pStream from a general non-ZEN context. Note that pStream will be created if not supplied, hence the ByRef designation.
pRewindStream controls whether the stream should be rewound after the data is written to it.
tProvider allows parameters to be passed in by creating an instance of the jsonMDXProvider and passing it into the method. The value of pMDX will be ignored in this case.
classmethod %WriteJSONStreamFromPivot(ByRef pStream As %Stream.Object, pPivot As %String, pRewindStream As %Boolean = 0, tProvider As %ZEN.Auxiliary.jsonMDXProvider = "") as %Status [ Language = objectscript ]
Utility method to allow JSON output generated by the stored pivot table defined in pPivot to be written to the stream supplied in pStream from a general non-ZEN context. Note that pStream will be created if not supplied, hence the ByRef designation.
pRewindStream controls whether the stream should be rewound after the data is written to it.
tProvider allows parameters to be passed in by creating an instance of the jsonMDXProvider and passing it into the method. The value of pPivot will be ignored in this case.

Inherited Members

Inherited Properties (Including Private)

Inherited Methods (Including Private)

Feedback