Focal Point
[CLOSED] get Object Handle for Resource Analyzer records

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4107096676

June 12, 2015, 11:44 AM
Emily Max
[CLOSED] get Object Handle for Resource Analyzer records
Hello.
We need to create custom reports off Resource Analyzer data, and found that there is no easy way to tie the Resource Analyzer data back to the specific object in the WF Repository that was executed. I submitted a feature request to add the Object Handle key identifier field to the Resource Analyzer tables for a future version. In the meantime, here is the database function I created to get to the handle in case anyone else is trying to do the same thing. We are on version 8.0.09 and our repositories are on SQL Server.
  
CREATE FUNCTION [dbo].[GetHandle](@fex_name varchar(254), @basedir varchar(254), @scheduleid char(66))
RETURNS nvarchar(255)
AS 
BEGIN
	DECLARE @handle nvarchar(255);

	IF @scheduleid != ''
		SET @handle = 
			(SELECT min(x1.taskobj) FROM WF_Repository.dbo.botsched x0
			INNER JOIN WF_Repository.dbo.bottask x1
			ON x0.PACKETID = x1.PACKETID AND x0.SCHEDULEID = @scheduleid);
	ELSE IF @fex_name = 'AdhocRequest' AND @basedir != '' 
		SET @handle = 
			(SELECT min(handle) FROM WF_Repository.dbo.WF_REPOSOBJ
			WHERE cast('IBFS:' as nvarchar(5)) + prt_path + cast('/' as nvarchar(1))+ objname =
				@basedir + '.fex');
	ELSE IF @fex_name != 'AdhocRequest' and @scheduleid = ''
		SET @handle = 
			(SELECT min(x0.handle) FROM WF_Repository.dbo.WF_REPOSOBJ x0
			INNER JOIN WF_Repository.dbo.WF_NLSOBJ x1
			ON x0.handle = x1.obj_handle
			AND x1.objdesc = @fex_name
			AND cast('IBFS:' as nvarchar(5)) + x0.prt_path = @basedir);
	ELSE
		SET @handle = '';
	
	RETURN @handle
END

GO



I hope this helps someone.

Happy coding,

Emily

This message has been edited. Last edited by: Tamra,


WF 8.1.05 on Windows machines
Backend: Informix, SQL and Oracle databases