简体   繁体   English

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

[英]Cognos 8 Query to find all Report and Column Names

I want to query the meta data in Cognos 8 to find all report and column names. 我想在Cognos 8中查询元数据以查找所有报告和列名称。 If possible, I'd like to include the column definitions. 如果可能,我想包括列定义。

Can I do this using a Cognos report or do I need to query some repository? 我可以使用Cognos报告执行此操作,还是需要查询某些存储库?

Thanks. 谢谢。

You can select a list of reports from the content store with the following query: 您可以使用以下查询从内容存储库中选择报告列表:

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;

I use that in Cognos 10. I believe in cognos 8 the CMOBJNAMES_BASE table is actually named 'CMOBJNAMES' without the _BASE. 我在Cognos 10中使用它。我相信在Cognos 8中,CMOBJNAMES_BASE表实际上没有_BASE而被命名为'CMOBJNAMES'。

The Report metadata is stored in the 'SPEC' column of CMOBJPROPS7 as XML. 报告元数据以XML格式存储在CMOBJPROPS7的“SPEC”列中。 You can parse this XML in order to strip out the columns used in the report. 您可以解析此XML以删除报表中使用的列。 It will not be a simple task. 这不是一项简单的任务。

If you have time but not money, you can write your own code to parse that XML. 如果你有时间但没有钱,你可以编写自己的代码来解析XML。 If you have more money than time, you can buy a 3rd party program to accomplish this, such as Motio or BSP Metamanager. 如果你有比时间更多的钱,你可以购买第三方程序来实现这一目标,例如Motio或BSP Metamanager。

The query above is less useful for building a clean list of columns, but great for searching for specific data items. 上面的查询对于构建干净的列列表没那么有用,但对于搜索特定数据项非常有用。 For example, you have column you are wanting to change in a data source, but you are not sure which report uses that column. 例如,您有要在数据源中更改的列,但您不确定哪个报表使用该列。 Run the query above, and search for the data item. 运行上面的查询,并搜索数据项。 It will be embedded within the XML in the Cognos MDX format, ie. 它将以Cognos MDX格式嵌入到XML中,即。 [Presentation View].[Sales Summary].[Sales] [演示文稿视图]。[销售摘要]。[销售]

EDIT: As requested below, here is a query that includes folder paths. 编辑:根据下面的要求,这是一个包含文件夹路径的查询。

-- 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;

Not sure if this will help anybody, but our version doesn't have a table named CMOBJNAMES_BASE. 不确定这是否会对任何人有所帮助,但我们的版本没有名为CMOBJNAMES_BASE的表。

This is what works for me: 这对我有用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM