Skip to content

Query

Query interface for dispatch, users, programs and statistics.

IdFromHandle

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

Run a dispatch query

  • Object
  • handle:String A handle
  • entity group | tracker | script | swimlane

Id from the handle

QueryDispatch

core.QueryDispatch(query)

Run a dispatch query

  • query:String dispatch query

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