Why does Harvest HSQL query list no versions on certain projects?

Tom Bing's picture
Tom Bing asked on October 27, 2011 - 10:27pm | Replies (1).

I have a query that works as I expect only on some projects. (This is with Harvest r7.1 using an Oracle 10g database.):

SELECT En.EnvironmentName, ST.Statename,
PF.PathFullName || '\' ||IT.ItemName AS "Pathname",
VR.MappedVersion,
TO_CHAR(VR.CreationTime, 'YYYY/MM/DD HH24:MI:SS') AS "Created",
U.Username as "UserID", U.Realname as "Name"
FROM HarEnvironment EN,
HarState ST,
HarView VW, HarVersionInView VV,
HarVersions VR, HarItems IT,
HarPathFullName PF,
Harallusers U
WHERE IT.ItemType = 1
AND EN.EnvironmentName = 'EMERALD3'
AND ST.Statename in ('Coding','Development')
AND EN.EnvObjId = VW.EnvObjId
AND VW.ViewObjId = VV.ViewObjId
AND ST.ViewObjID = VW.ViewObjId
AND VV.VersionObjId = VR.VersionObjId
AND VR.ItemObjId = IT.ItemObjId
AND IT.ParentObjId = PF.ItemObjId
AND U.Usrobjid = VR.Creatorid
order by EN.Environmentname, VR.CreationTime ;

The intent was to list all file versions in the specified project and states in order of VR.CreationTime. However, it seems to always get zero results when the only versions are the BASE (0) versions. Apparently a project newly baselined from a snapshot will show zero results.

How should I change the query to show these BASE versions now being skipped?

Thanks,
Tom

1 Answer

rhthornburrow's picture

Your query only looks for rows in versioninview which are in your working view. You also need to look for rows which are in the baseline view. You can get the object id of the baseline view from the state's view as baselineviewid. With your query I'd guess that:

AND VW.ViewObjId = VV.ViewObjId

needs to become:

AND VV.ViewObjId IN (VW.ViewObjId, VW.BaselineViewId)

Cheers R.

CMCrossroads is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.