adoat
7 months agoNew Contributor III
How can I retrieve in a cube view the assigned workflow for every entity ?
Hi,
A question that come back rather often is how to retrieve in a "user friendly" format the workflow an entity is assigned to.
You can find hereunder a dynamiccalc you can assign to an UD8 in order to retrieve that information.
Hope this helps.
Kind regards,
Aymar
'This dynamiccalc member will show the workflow profile of the Entity as an Annotation
'User need to have access to the CubeRoot workflow profile Info
If api.View.IsAnnotationType() Then
Dim sourceSQL As New Text.StringBuilder
Dim returnedText As New Text.StringBuilder
Dim wfCubeRootInfo As WorkflowCubeRootInfo = TryCast(BRApi.Workflow.Metadata.GetCubeRootInfo(si, BRApi.Workflow.General.GetWorkflowUnitPk(si).ProfileKey, False),WorkflowCubeRootInfo)
If Not wfCubeRootInfo Is Nothing Then
sourceSQL.Append("SELECT [EntityMemberID]")
sourceSQL.AppendLine(",[ProfileName]")
sourceSQL.AppendLine("FROM [WorkflowProfileEntities]")
sourceSQL.AppendLine("INNER Join [WorkflowProfileHierarchy] On [WorkflowProfileKey] = [ProfileKey]")
sourceSQL.AppendLine("WHERE CubeRootProfileKey = '" & wfCubeRootInfo.CubeRootProfile.UniqueID.ToString & "'")
Dim dt As DataTable = api.Functions.GetCustomBlendDataTable(BlendCacheLevelTypes.Custom, "entity_WFPAssignment", "Application", sourceSQL.ToString)
If dt.Select("EntityMemberID = " & api.Pov.Entity.MemberId).Count() > 0 Then
For Each dtRow In dt.Select("EntityMemberID = " & api.Pov.Entity.MemberId)
returnedText.Append(dtRow(1).ToString).AppendLine
Next
Return returnedText.ToString
Else
Return "Not Assigned"
End If
End If
Else
'Return a NoData Datacell
Return api.Data.CreateDataCellObject(0.0,True, False)
End If