Skip to content

Query

Query interface for dispatch, users, programs and statistics.

IdFromHandle

core.IdFromHandle({handle="process-time", entity="script"})

Run a dispatch query

  • Object
  • handle:String A handle
  • entity group | tracker | script | swimlane | cohort | program | user-labels | dispatch-labels | workflow | wiki | layout

Id from the handle

core.IdFromHandle({handle="process-time", entity="script"})

HandleFromId

core.HandleFromId({id="xxxx-xxxx-xxx..", entity="script"})

Run a dispatch query

  • Object
  • id:String A handle
  • entity group | tracker | script | swimlane | cohort | program | user-labels | dispatch-labels | workflow | wiki | layout

Handle from the id

QueryDispatch

core.QueryDispatch(query, optional)

Run a dispatch query

  • query:String dispatch query
  • optional: String array optional items to load in the query

By default optional is "body", "data". Other optional items available include "attributes", "blocks", "actions", "comments", "labels", "hashtags", "userLocation*", "countComments"

Dispatch list

Example

local ls = core.QueryDispatch("current user, given tracker [something]")
for index, dispatch in pairs(ls) do 
    log.pairs(dispatch.data)
end

QueryDispatchRemote

core.QueryDispatchRemote({query="given tracker [report]", apiKey="..", apiSecret="..", orgId=".."})

Run a dispatch query to pull data from another org. The API key from that org is required to complete the query.

  • query:String dispatch query
  • apiKey:UUID Api key id
  • apiSecret:String Api key secret
  • orgId:UUID Org id to request the data from; api key should come from this org

Dispatch list

Example

local ls = core.QueryDispatch("current user, given tracker [something]")
for index, dispatch in pairs(ls) do 
    log.pairs(dispatch.data)
end

QueryUser

core.QueryUser(query)

Run a user query

  • query:String user query

User Array

QueryProgram

core.QueryProgram(query)

Run a program query

  • query:String program query

ProgramInfo Array

QueryParticipant

core.QueryParticipant(query)

Run a program query

  • query:String program participant query

ProgramParticipation Array

QueryStats

core.QueryStats(query)

Run a stats query

  • query:String stats query
  • Stats list object
    • users: UserTotal Array
    • results: UserStatistic Array
    • start
    • end
    • operator

OrgList

core.OrgList()

Return the list of child orgs.

Org Array

OrgUserQuery

core.OrgUserQuery({org=id, query=string})

Run a user query on a specific child org

  • Object
    • org:UUID org id
    • query:String user query

User Array

OrgChildAllowed

core.OrgChildAllowed(orgId)

Check if a child org is within scope.

  • orgId:UUID org Id

Boolean

FindUserByEmail

core.FindUserByEmail(email)

Find user by email

  • email:String email address

User

FindUserByExternalId

core.FindUserByExternalId(id)

Find user by external id registered for that org

  • id:String external id

User

LastActivity

core.LastActivity(userId)

Check if a user was active within a specific time range

  • Object
    • userId:UUID user id
    • from:Date date in YYYY-MM-DD format
    • to:Date date in YYYY-MM-DD format
    • ignore:UUID[] array of tracker ids; optional

Date or nil

QueryActions

core.QueryActions({dispatchId = id, event = "bookmark", groupBy = "payload"})

Get summary information about the count of a specific event.

  • Object
    • dispatchId:UUID user id
    • event:String event to query such as like, vote, bookmark
    • groupBy payload | ; group by payload or not

List of DispatchActionStatus objects

QueryActionList

core.QueryActionList({dispatchId = id, query = "all events"})

Get specific event details

  • Object
    • dispatchId:UUID user id
    • query:String query

Query examples:

  • all events
  • given event [participant]
  • given author [xxxx-xxxx-xxxx]
  • given user [xxxx-xxxx-xxxx]
  • (query clause) from (date clause)

List of DispatchAction objects

AccountFromId

core.AccountFromId(accountId)

Load account info

  • UUID - the id of the account to find

AccountSearch object or nil

AccountsFromUser

core.AccountsFromUser(userId)

Get summary information about the count of a specific event.

  • UUID - the id of the user to search for

List of AccountSearch objects

LoadWiki

core.LoadWiki(handle)

Load wiki content

  • String - handle for the wiki content to load

Wiki content