Cognos 8 Query查找所有报告和列名称

时间:2014-06-20 15:28:35

标签: reporting cognos cognos-8

我想查询Cognos 8中的元数据以查找所有报告和列名称。如果可能,我想要包含列定义。

我可以使用Cognos报告执行此操作,还是需要查询某些存储库?

感谢。

2 个答案:

答案 0 :(得分:7)

您可以使用以下查询从内容存储库中选择报告列表:

SELECT     CMOBJNAMES_BASE.NAME AS ObjName, CMOBJECTS.PCMID, CMCLASSES.NAME AS ClassName, CMOBJPROPS7.spec
FROM       CMOBJECTS 
JOIN       CMOBJNAMES_BASE ON CMOBJECTS.CMID    = CMOBJNAMES_BASE.CMID
JOIN       CMCLASSES       ON CMOBJECTS.CLASSID = CMCLASSES.CLASSID
LEFT JOIN  CMOBJPROPS7     ON CMOBJECTS.CMID = CMOBJPROPS7.CMID
WHERE     CMOBJECTS.CLASSID IN (10, 37)
ORDER BY CMOBJECTS.PCMID;

我在Cognos 10中使用它。我相信认知8,CMOBJNAMES_BASE表实际上没有_BASE而被命名为'CMOBJNAMES'。

报告元数据以XML格式存储在CMOBJPROPS7的“SPEC”列中。您可以解析此XML以删除报表中使用的列。这不是一项简单的任务。

如果您有时间但没有钱,您可以编写自己的代码来解析该XML。如果你有比时间更多的钱,你可以购买第三方程序来实现这一目标,例如Motio或BSP Metamanager。

上面的查询对于构建干净的列列表没那么有用,但非常适合搜索特定的数据项。例如,您有要在数据源中更改的列,但您不确定哪个报表使用该列。运行上面的查询,并搜索数据项。它将以Cognos MDX格式嵌入到XML中,即。 [演示文稿视图]。[销售摘要]。[销售]

编辑:根据下面的要求,这是一个包含文件夹路径的查询。

-- List of Reports, the folder they are in, and the package they are using
select distinct temp2.name as package,temp1.folder,temp1.name from
(SELECT    temp.PARENTNAME AS FOLDER,CMOBJECTS.PCMID,CMOBJNAMES.CMID, CMOBJNAMES.LOCALEID, CMOBJNAMES.MAPDLOCALEID, CMOBJNAMES.ISDEFAULT, CMOBJNAMES.NAME, 
                      CMOBJECTS.CLASSID
FROM         CMOBJNAMES INNER JOIN
                      CMOBJECTS ON CMOBJNAMES.CMID = CMOBJECTS.CMID
INNER JOIN
(SELECT P.CMID AS PARENT,P.NAME AS PARENTNAME FROM CMOBJNAMES P where P.LOCALEID between 24 and 52) temp
ON CMOBJECTS.PCMID = TEMP.PARENT
WHERE     (CMOBJECTS.CLASSID = 10)
AND SUBSTR(TEMP.PARENTNAME,1,1) NOT IN ('1','2','3','4','5','6','7','8','9') AND
TEMP.PARENTNAME NOT LIKE 'Backup%') temp1
inner join
(SELECT  CMREFNOORD1.CMID AS PID, CMREFNOORD1.REFCMID, CMOBJNAMES.NAME
FROM         CMREFNOORD1 INNER JOIN
                      CMOBJECTS ON CMREFNOORD1.REFCMID = CMOBJECTS.CMID INNER JOIN
                      CMOBJNAMES ON CMOBJECTS.CMID = CMOBJNAMES.CMID
WHERE     (CMREFNOORD1.PROPID = 31 AND CMOBJNAMES.LOCALEID between 24 and 52)) temp2
on temp1.cmid = temp2.pid and LOCALEID between 24 and 52;

答案 1 :(得分:0)

不确定这是否对任何人都有用,但是我们的版本没有名为CMOBJNAMES_BASE的表。

这对我有用:

select ob2.cmid, c.name as classname, n.name as objectname, o.DELIVOPTIONS as deliveryoptions, z2.name as owner
from CMOBJPROPS2 p
inner join CMOBJPROPS26 o on p.cmid=o.cmid
inner join CMOBJECTS ob on ob.cmid=o.cmid
inner join CMOBJECTS ob2 on ob.pcmid=ob2.cmid
inner join CMOBJNAMES n on n.cmid=ob2.cmid
inner join CMCLASSES c on ob2.classid=c.classid
left join CMREFNOORD2 z1 on z1.cmid = p.cmid
left join CMOBJPROPS33 z2 on z2.CMID = z1.REFCMID
where ACTIVE = 1 order by z2.name, objectName