RunViewParams: {
    AuditLogDescription?: string;
    CacheLocal?: boolean;
    CacheLocalTTL?: number;
    EntityName?: string;
    ExcludeDataFromAllPriorViewRuns?: boolean;
    ExcludeUserViewRunID?: string;
    ExtraFilter?: string;
    Fields?: string[];
    ForceAuditLog?: boolean;
    IgnoreMaxRows?: boolean;
    MaxRows?: number;
    OrderBy?: string;
    OverrideExcludeFilter?: string;
    ResultType?: "simple" | "entity_object" | "count_only";
    SaveViewResults?: boolean;
    StartRow?: number;
    UserSearchString?: string;
    ViewEntity?: BaseEntity;
    ViewID?: string;
    ViewName?: string;
    _fromEngine?: boolean;
}

Parameters for running either a stored or dynamic view. A stored view is a view that is saved in the database and can be run either by ID or Name. A dynamic view is one that is not stored in the database and you provide parameters to return data as desired programatically.

Type declaration

  • Optional AuditLogDescription?: string

    optional - if provided and either ForceAuditLog is set, or the entity's property settings for logging view runs are set to true, this will be used as the Audit Log Description.

  • Optional CacheLocal?: boolean

    When set to true, the RunView will first check the LocalCacheManager for cached results. If cached results exist and are still valid, they will be returned immediately without hitting the server. This is useful for frequently-accessed, relatively-static data.

    Note: The LocalCacheManager must be initialized before this can work. Cached results are automatically invalidated when the underlying entity data changes.

    Default

    false
    
  • Optional CacheLocalTTL?: number

    Optional TTL (time-to-live) in milliseconds for cached results when CacheLocal is true. After this time, cached results will be considered stale and fresh data will be fetched. If not specified, the LocalCacheManager's default TTL will be used (typically 5 minutes).

  • Optional EntityName?: string

    optional - this is only used if ViewID/ViewName/ViewEntity are not provided, it is used for Dynamic Views in combination with the optional ExtraFilter

  • Optional ExcludeDataFromAllPriorViewRuns?: boolean

    optional - if set to true, the resulting data will filter out ANY records that were ever returned by this view, when the SaveViewResults property was set to true. This is useful if you want to run a particular view over time and make sure the results returned each time are new to the view.

  • Optional ExcludeUserViewRunID?: string

    optional - if provided, records that were returned in the specified UserViewRunID will NOT be allowed in the result set. This is useful if you want to run a particular view over time and exclude a specific prior run's resulting data set. If you want to exclude ALL data returned from ALL prior runs, use the ExcludeDataFromAllPriorViewRuns property instead.

  • Optional ExtraFilter?: string

    An optional SQL WHERE clause that you can add to the existing filters on a stored view. For dynamic views, you can either run a view without a filter (if the entity definition allows it with AllowAllRowsAPI=1) or filter with any valid SQL WHERE clause.

  • Optional Fields?: string[]

    An optional array of field names that you want returned. The RunView() function will always return ID so you don't need to ask for that. If you leave this null then for a dynamic view all fields are returned, and for stored views, the fields stored in it view configuration are returned.

  • Optional ForceAuditLog?: boolean

    optional - if set to true, the view run will ALWAYS be logged to the Audit Log, regardless of the entity's property settings for logging view runs.

  • Optional IgnoreMaxRows?: boolean

    optional - if set to true, if there IS any UserViewMaxRows property set for the entity in question, it will be IGNORED. This is useful in scenarios where you want to programmatically run a view and get ALL the data back, regardless of the MaxRows setting on the entity.

  • Optional MaxRows?: number

    optional - if provided, and if IgnoreMaxRows = false, this value will be used to constrain the total # of rows returned by the view. If this is not provided, either the default settings at the entity-level will be used, or if the entity has no UserViewMaxRows setting, all rows will be returned that match any filter, if provided.

  • Optional OrderBy?: string

    An optional SQL ORDER BY clause that you can use for dynamic views, as well as to OVERRIDE the stored view's sorting order.

  • Optional OverrideExcludeFilter?: string

    optional - if you are providing the optional ExcludeUserViewRunID property, you can also optionally provide this filter which will negate the specific list of record IDs that are excluded by the ExcludeUserViewRunID property. This can be useful if you want to ensure a certain class of data is always allowed into your view and not filtered out by a prior view run.

  • Optional ResultType?: "simple" | "entity_object" | "count_only"

    Result Type is: 'simple', 'entity_object', or 'count_only' and defaults to 'simple'. If 'entity_object' is specified, the Results[] array will contain BaseEntity-derived objects instead of simple objects. This is useful if you want to work with the data in a more strongly typed manner and/or if you plan to do any update/delete operations on the data after it is returned. The 'count_only' option will return no rows, but the TotalRowCount property of the RunViewResult object will be populated.

  • Optional SaveViewResults?: boolean

    optional - if set to true, the LIST OF ID values from the view run will be stored in the User View Runs entity and the newly created UserViewRun.ID value will be returned in the RunViewResult that the RunView() function sends back to ya.

  • Optional StartRow?: number

    optional - if provided, this value will be used to offset the rows returned.

  • Optional UserSearchString?: string

    optional - string that represents a user "search" - typically from a text search option in a UI somewhere. This field is then used in the view filtering to search whichever fields are configured to be included in search in the Entity Fields definition. Search String is combined with the stored view filters as well as ExtraFilter with an AND.

  • Optional ViewEntity?: BaseEntity

    optional - this is the loaded instance of the BaseEntity (UserViewEntityComplete or a subclass of it). This is the preferred parameter to use IF you already have a view entity object loaded up in your code becuase by passing this in, the RunView() method doesn't have to lookup all the metadata for the view and it is faster. If you provide ViewEntity, ViewID/ViewName are ignored.

  • Optional ViewID?: string

    optional - ID of the UserView record to run, if provided, ViewName is ignored

  • Optional ViewName?: string

    optional - Name of the UserView record to run, if you are using this, make sure to use a naming convention so that your view names are unique. For example use a prefix like _Entity_View etc so that you're likely to have a single result. If more than one view is available that matches a provided view name an exception will be thrown.

  • Optional Internal _fromEngine?: boolean

    Internal flag set by BaseEngine when loading entity configurations. When true, telemetry analyzers will skip false-positive warnings about "entity already loaded by engine" since the engine IS the one calling RunView.

    This property is for framework internal use only.