A suite of rostrvm pre-defined database functions are provided for some of the more common operations.  These are defined here as a quick reference guide.


rtm_duration (n)

Given a time in the format hh:mm:ss or an integer, returns the number of seconds followed by ‘s’.

For example:

    rtm_duration(’00:02:03’) = 123s

    rtm_duration(32)         = 32s

 


rtm_is_inbound(ORIGIN_TYPE)

Returns TRUE for inbound contacts if ORIGIN_TYPE matches ‘%Inbound%’.  This can be used with the ORIGIN_TYPE column from the calls table.  It is equivalent to the SQL:

    ORIGIN_TYPE LIKE '%Inbound%'

 


rtm_is_outbound(ORIGIN_TYPE)

Returns TRUE for outbound contacts when provided with the ORIGIN_TYPE column from the calls table.  It is equivalent to the SQL:

    ORIGIN_TYPE NOT LIKE '%Inbound%'

 


rtm_media(ORIGIN_TYPE)

Returns 'email' for email type contacts, 'chat' for chat type contacts, 'sms' for outbound SMS messages, and 'call' otherwise.  The parameter supplied should be the ORIGIN_TYPE from the calls table.


rtm_bar(property,tooltip,colour,value)

Returns an encoded string used for generating the ‘worms’ on report displays.


rtm_start_from_name(date,time)

Returns a start time based on the value of date, where date can be either an ISO date (e.g. 2019-02-14) or a name (i.e. Today, Yesterday, Tomorrow, This Week, Next Week, Last Week, This Month, Last Month, Next Month, Week to date, Month to date, All Time or Last Hour).  Time is used if it is not null, otherwise 00:00:00 is used.


rtm_end_from_name(date,time)

Returns an end time based on the value of date, where date can be either an ISO date (e.g. 2019-02-14) or a name (i.e. Today, Yesterday, Tomorrow, This Week, Next Week, Last Week, This Month, Last Month, Next Month, Week to date, Month to date, All Time or Last Hour).  Time is used if it is not null, otherwise 23:59:59 is used.


rtm_start(date,time)

Returns a start time based on the parameters.  NULL values equate to today for the date and 00:00:00 for the time.


rtm_end(date,time)

Returns an end time based on the parameters.  NULL values equate to today for the date and 23:59:59 for the time.