Idea ID 2738889
Add a "Swimlane" system field to be auto-set based on the workflow
Swimlanes allow the aggregation of several states in the graphical workflow design into logical groupings based on role, high-level status, or other "second-level" category. The current functionality is useful for display and visualization purposes, but there is no tie back to actual data in the workflow for reporting or display on the forms. It would be very useful to add a new system/derived "Swimlane" field which ties back to a value that could be used in listing, distribution, or trend reports, as well as placed on the forms through Composer.
As a proof-of-concept / current workaround, I have written a SQL function which returns the swimlane of any given field. We have worked this into an AppScript which sets a textual "Swimlane" field on each transition.
-- Author: Jeff Malin
-- Create date: 8/5/2016
-- Description: Given a State ID, return the string name of its Swimlane
CREATE FUNCTION [dbo].[GetStateSwimlaneName]
-- Determine Workflow ID from State to restrict swimlane calculations
DECLARE @WORKFLOWID int
set @WORKFLOWID = (select ts_projectid from TS_STATES where TS_id = @STATEID)
-- Create temp table to hold lane start/end data
DECLARE @SWIMLANELAYOUT TABLE (
INSERT INTO @SWIMLANELAYOUT
lanedata.TS_NAME as 'SwimlaneName'
,lanedata.startx + 1 as 'SwimlaneStartX'
,lanedata.startx + lanedata.ts_size as 'SwimlaneEndX'
from ( -- SBM Swimlanes table only records width. Determine Start/End offset by aggregating in order
select swimlane.TS_NAME, swimlane.ts_size, isnull((SELECT SUM(layout.ts_size)
FROM ts_gwebands layout
WHERE layout.ts_workflowid = @WORKFLOWID and layout.ts_id < swimlane.ts_id), 0) as startx
from ts_gwebands swimlane
where swimlane.ts_workflowid = @WORKFLOWID
) as lanedata
DECLARE @SWIMLANENAME varchar(max)
set @SWIMLANENAME = (
select lanedata.SwimlaneName from
ts_states states on states.ts_id = statelayout.ts_stateid
@SWIMLANELAYOUT as lanedata -- Search using State position on Swimlane layout temp table
on lanedata.LANESTARTX < statelayout.TS_CENTERX
and lanedata.LANEENDX > statelayout.TS_CENTERX
states.ts_id = @STATEID
and states.ts_status = 0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.