# Think Time after Viewing an APEX Interactive Report (IR)

 I had someone ask me how to get the think time after someone views an Interactive Report. I think the query below does it.

with page\_views\_with\_previous\_view\_id as 

  (select application\_id, page\_id, apex\_user, apex\_session\_id, page\_view\_type, view\_timestamp, 

          lead(view\_timestamp, 1) OVER (ORDER BY view\_timestamp desc) AS prev\_view\_ts

    from apex\_workspace\_activity\_log al

    where application\_id = :APP\_ID

    )

  select pv.\*,

         pv.view\_timestamp - ppv.view\_timestamp think\_time,

         ppv.interactive\_report\_id ppv\_ir\_id

  from page\_views\_with\_previous\_view\_id pv -- page\_view

  inner join apex\_workspace\_activity\_log ppv -- previous\_page\_view

    on ppv.view\_timestamp = pv.prev\_view\_ts

    and ppv.application\_id = :APP\_ID

      and ppv.apex\_session\_id = pv.apex\_session\_id

      and ppv.page\_id = 2

      and ((ppv.interactive\_report\_id = 38006896117622159377) -- if you hard code the ID

           or   -- use the region static id

                (ppv.interactive\_report\_id = (select pir.interactive\_report\_id 

                                                from apex\_application\_page\_ir pir 

                                                inner join apex\_application\_page\_regions pr on pr.region\_id = pir.region\_id

                                                where pir.application\_id = :APP\_ID 

                                                  and pir.page\_id = 2

                                                  and pr.static\_id ='ANTON\_IR\_STATIC\_ID')

                )

           or

           (ppv.page\_view\_type = 'Rendering')

      )

  order by pv.view\_timestamp desc

  

  

Maybe this will help another person as well.
