Our organization has upgraded to XI so it uses a different database model for the Audit database (actually provides less information, especially on folder structures). With CE10 we used SQL Server to store the Audit data and here is the query I wrote to get unviewed reports. It is in SQL Server syntax.
SELECT
A.ObjectName,
max(B.UserName) as UserName,
max(A.Timestamp) as TimeStamp,
max(B.AuditString) as AuditString,
max(A.ObjectPath) as ObjectPath
FROM ClarityAuditing.dbo.CMS_AUDITTABLE as A
Left Outer JOIN
/* find viewed reports */
(SELECT
CMS_AUDITTABLE.ObjectName,
CMS_AUDITTABLE.UserName,
max(CMS_AUDITTABLE.TimeStamp) as TimeStamp,
max(Cast(CMS_AUDITTABLE.AuditString as VarChar(50))) as AuditString,
max(CMS_AUDITTABLE.ObjectPath) as ObjectPath
FROM ClarityAuditing.dbo.CMS_AUDITTABLE CMS_AUDITTABLE
WHERE (CMS_AUDITTABLE.ObjectName>N' ' AND CMS_AUDITTABLE.AuditID = '196609.00')
and convert(datetime,left(timestamp,10),101) > getdate()-62
Group By CMS_AUDITTABLE.ObjectPath, CMS_AUDITTABLE.ObjectName, CMS_AUDITTABLE.UserName
) B
ON A.ObjectPath = B.ObjectPath
WHERE (A.ObjectName>N' '
AND Left(Cast(A.AuditString as VarChar(15)),14) = 'Job Successful'
AND convert(datetime,left(A.timestamp,10),101) > getdate()-62)
AND B.ObjectName IS NULL
Group By A.ObjectPath, A.ObjectName
Order By A.ObjectName
Paste this query into a Command Object in the Crystal Report.
Also, I parsed the directory structure from the ObjectPath like this in a Formula.
WhileReadingRecords;
global stringvar hold1;
global stringvar hold2;
global stringvar dir1;
global stringvar dir2;
if instr({Command.ObjectPath},"/") > 0 then
dir1 := mid({Command.ObjectPath},2,instr(2,{Command.ObjectPath},"/")-1);
if instr({Command.ObjectPath},"/") > 0 then
hold1 := mid({Command.ObjectPath},instr(2,{Command.ObjectPath},"/"),len({Command.ObjectPath})-2);
if instr(2,{Command.ObjectPath},"/") > 0 then
dir2 := mid(hold1,2,instr(2,hold1,"/")-1);
hold1;