08-05-2020 03:35 PM
Hi All,
Do you have a example of a Reporting Dashboards macro to pass the Current User ID? I'm trying to convert the following custom SQL query for Document Types viewed by the current user and cannot get Reporting Dashboards to pass the Current User ID. I've tried use the ##OB_CURRENTUSER_ID and the ##OB_CURRENTUSER_NAME Macro to work. It's probably my syntax.
SQL QUERY
-------------------
SELECT d.itemtypename AS "Document Type", i.batchnum AS "Batch #", tx.logdate AS "Date", LTRIM(RIGHT(convert(varchar, tx.logdate, 100),7)) AS "Time", tx.tmessage AS "Message"FROM hsi.transactionxlog AS tx INNER JOINhsi.itemdata AS i ON tx.num = i.itemnum INNER JOINhsi.doctype AS d ON i.itemtypenum = d.itemtypenumWHERE (tx.usernum = @LoggedUserNum) AND(tx.logdate BETWEEN @DateRangeFromDate AND @DateRangeToDate) AND(tx.actionnum = 4 AND tx.subactionnum = 1)ORDER BY tx.logdate
Much appreciated,
Mike
08-05-2020 03:39 PM
Hi Mike,
Here's what I use:
select distinct T.ITEMNUM, rtrim(D.ITEMTYPENAME), rtrim(I.ITEMNAME), max(T.LOGDATE), case when I.STATUS = '16' then 'Deleted' else NULL end as DocumentStatusfrom TRANSACTIONXLOG T, ITEMDATA I, DOCTYPE Dwhere T.ITEMNUM = I.ITEMNUM and I.ITEMTYPENUM = D.ITEMTYPENUM and T.ACTION = '32' and T.USERNUM = ##OB_CURRENTUSER_ID and T.LOGDATE >= sysdate -30group by T.ITEMNUM, D.ITEMTYPENAME, I.ITEMNAME, case when I.STATUS = '16' then 'Deleted' else NULL endorder by max(T.LOGDATE) desc ;
08-05-2020 03:46 PM
Thanks so much Larissa
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.