Generic Properties in Expression Language: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:
!'''Property'''
!'''Property'''
! '''Description'''
! '''Description'''
|-
|_system
|
|-
|-
||CachedItems (String*)
||CachedItems (String*)

Revision as of 09:34, 19 November 2024

Configuration data properties

Property Description
_system
CachedItems (String*) Returns a string array of all cache item keys currently stored in the in the memory cache. Global ManageOperations permission is needed to use this property.
CurrentUser (User) Returns the current user as User object.
Dashboards (Dashboard*) Returns all dashboards in the system that user has permissions to.
Models (Model*) All models in the system that user has permissions to.
OperationLog (SqlDataFrame) Returns the operation log (task log) as SqlDataFrame where each log entry is as a row. There is an entry in the operation log for all requests that have been done to the server api. Also script runs and loading of model can be seen as operations.

If user has ManageOperations permission, user sees all entries in the log. Other users can only see her/his own log entries.

There are following columns in the SqlDataFrame:

  • Id (integer): Log entry unique id.
  • Type (string): Log entry type.
  • SessionId: Id of the session where the operation was created.
  • UserId (integer): Id of the user who created the operation.
  • ModelId (integer): Id of the model which the operation is related to.
  • DashboardId (integer): Id of the dashboard where the request is originated from.
  • StartTime (date): Start timestamp of the operation.
  • EndTime (date): End timestamp of the operation. If the operation is in progress, the EndTime is null. Note that the operation log may also contain ended entries where EndTime is not defined because the server might have shutdown forcefully while the operation is in progress.
  • Result (string): Error message for failed operation.
  • ParametersJson (string): Input parameters of the operation in json format. Collection of the operation log in json format has been added in QPR ProcessAnalyzer 2023.8, so the ParametersJson field returns null for log entries made before the update.
  • Parameters (string): Input parameters of the operation in comma-separated format. This is a legacy field for log entries before updating to QPR ProcessAnalyzer 2023.8. Use the ParametersJson field for entries made after the update.
  • UserName (string): User login name who created the operation.
  • UserFullName (string): User full name who created the operation.
  • DashboardName (string): Dashboard name which the operation is related to.
  • DashboardProjectName (string): Name of project where the related dashboard is located.
  • ModelName (string): Model name which the operation is related to.
  • Cancelled (boolean): Whether the operation was requested to be cancelled by a user. The system tries to stop the cancelled operations as soon as possible.

Example: Return top 100 log entries made by user qpr starting from year 2023:

OperationLog
  .Where(Column("UserName") == "qpr" && Column("StartTime") > #expr{DateTime(2023)})
  .OrderByColumns(["StartTime"], [false])
  .Select(["Type","StartTime", "EndTime"])
  .Head(100)
  .Collect();
Projects (Project*) Returns all projects in the system that user has permissions to.
RecycleBin.Objects (Model/Project*) Return all items that are deleted, i.e. in the recycle bin. This operation is available only for the system administrators. This is the only way to get the deleted models and projects. Note that when a project is deleted, also its containing models are listed in the recycle bin.

Calling Recyclebin.DeletePermanently() deletes permanently multiple objects (models and projects) at the same time. Takes an array of entities as parameter. Deleting multiple objects at the same time is useful when objects are children of each other, as deleting them one by one should be done in a correct order starting from the leaf level of hierarchy.

RoleAssignments (SqlDataFrame) Returns the role assignments given in the User Management as an SqlDataFrame. In the user management, global or project specific roles can be assigned to users and groups to give permissions to use the system. Each of the assignments are returned as a row. Using this property requires the ManageUsers permission.

There are the following columns in the SqlDataFrame:

  • Id (integer): Unique id of the role assignment.
  • UserId (integer): Id of the user or group the role assignment is given.
  • UserName (string): Username of the user the role assignment is given. Null for groups.
  • UserFullName (string): Name of the user or group the role assignment is given.
  • UserIsGroup (boolean): Whether this role assignment is given to a group (true) or a user (false).
  • UserIsActive (boolean): Whether the user is active or not.
  • ProjectId (integer): Id of the project the role assignment is related to. Null if it's an assignment of a global role.
  • ProjectName (string): Name of the project this role assignment is related to. Null if it's an assignment of a global role.
  • RoleId (integer): Unique id of the assigned role.
  • RoleName (string): Name of the assigned role.

Example: Give role assignment for all active users order by user and project.

RoleAssignments
  .Where(Column("UserIsGroup") == false && Column("UserIsActive") == true)
  .OrderByColumns(["UserName", "ProjectName"], [true, true])
  .Select(["UserName", "ProjectName", "RoleName"])
  .Collect()
  .ToCsv()
Scripts (Script*) Returns all scripts in the system.
UserGroups (User*) Returns user groups visible for the current user as User objects.
Users (User*) Returns users visible for the current user as User objects.

System memory usage properties

Property Description
AvailablePhysicalMemory (Integer) Returns the available (free) physical memory (in bytes) of the computer where QPR ProcessAnalyzer server is running.
TotalPhysicalMemory (Integer) Returns the total physical memory (in bytes) of the computer where QPR ProcessAnalyzer server is running.
UsedProcessMemory (Integer) Current memory consumption by the QPR ProcessAnalyzer Server in bytes.

Other properties

Property Description
_

Refers to the current context. See more information about expression context.

null Returns a special null value. Usually null represents non-existing or missing value. Null value is similar to EMPTY value, except null values can also be recursed.
_empty

Returns an object which represent a non-existent value. Textual representation of this value is "EMPTY".

_query (Dictionary) Returns configuration of the query being currently made as a dictionary. If run in a context where there is no query being made, a reference to undefined variable exception will be thrown.

Example: Returns the Filter parameter in the query:

_query.Configuration.Filter
_remove

A special value which, when traversing through a hierarchical object, means that an item in the hierarchical object should be removed.

Examples:

[1, 2, 3, 4].(2 * _)
Returns: [2, 4, 6, 8]

[1, 2, 3, 4].if(_ == 2,_remove,_)
Returns: [1, 3, 4]

For("i", 0, i < 10, i + 1, i).Where(_ % 2 == 0)
For("i", 0, i < 10, i + 1, i).If(_ % 2 == 0, _, _remove)
Both return:
[0, 2, 4, 6, 8]
AllBuiltInFunctions Returns all the built in functions as FunctionDefinition objects (as an array) no matter what their calculation context is.
AllBuiltInProperties Returns all the built in properties as FunctionDefinition objects (as an array) no matter what their calculation context is.
BuiltInFunctions Returns all the built in functions as FunctionDefinition objects (as an array) valid for the current calculation context.
BuiltInProperties Returns all the built in properties as FunctionDefinition objects (as an array) valid for the current calculation context.
CalcId (String)

Returns an id that is unique among all QPR ProcessAnalyzer objects in the server. CalcId remains the same at least for the duration of the expression calculation. It is possible that CalcId for an object is different in the next calculation.

CalculationContextTypeName (String)

Returns the type of the current calculation context.

Examples:

CalculationContextTypeName
Returns: "Generic"

[1, "a", [1, 2], Timespan(1, 2, 3, 4), DateTime(2016,1,1), Def("", _ + 1)].CalculationContextTypeName
Returns: ["Generic", "String", "Generic", "Timespan", "DateTime", "FunctionDefinition"]

EventLogById(<event log id>).CalculationContextTypeName
Returns: EventLog
CurrentOperationId (String) Returns id of the currently in-progress operation where the CurrentOperationId is called.
InternalTypeName (String) Returns the .NET type name of the context object.
ServerStartupTime (DateTime) Returns the timestamp when the QPR ProcessAnalyzer Server instance was last time started.