Forum Discussion

Sergey's avatar
Sergey
Contributor III
2 years ago

Documentation on XFGanttTaskCollection

Hello,

For a project management perspective, I would like to use the Gantt component in a dashboard. The documentation only explain that we should use XFGanttTaskCollection for that. Are there any implementation that have been using this component, any documentation to share about it ?

 

Regards,

  • Hi Sergey

    We are working on improving our documentation for developers. Till we got everything covered, the market place is a great source of knowledge.

    I learned a lot of interesting advanced concepts just by analyzing marketplace solutions. 

    The gantt component is used in the task scheduler marketplace solution. If you download an old version, the business rules are not encrypted and still accessible.

    Load it to an empty application and have a look.

    Good luck.

  • Sergey's avatar
    Sergey
    2 years ago

    Thanks Christian,

    For those interested, here's a bot of code I received that is a starting point for the Gantt component :

    Imports System
    Imports System.Collections.Generic
    Imports System.Data
    Imports System.Data.Common
    Imports System.Globalization
    Imports System.IO
    Imports System.Linq
    Imports System.Windows.Forms
    Imports Microsoft.VisualBasic
    Imports OneStream.Finance.Database
    Imports OneStream.Finance.Engine
    Imports OneStream.Shared.Common
    Imports OneStream.Shared.Database
    Imports OneStream.Shared.Engine
    Imports OneStream.Shared.Wcf
    Imports OneStream.Stage.Database
    Imports OneStream.Stage.Engine

    Namespace OneStream.BusinessRule.DashboardDataSet.GANTT
    Public Class MainClass
    Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object
    Try
    Select Case args.FunctionType

    Case Is = DashboardDataSetFunctionType.GetDataSetNames
    Dim names = New List(Of String)()
    names.Add("GanttDataSet")
    Return names

    Case Is = DashboardDataSetFunctionType.GetDataSet

    If args.DataSetName.XFEqualsIgnoreCase("GanttDataSet") Then
    Return Me.GanttDataSet(si, Globals)
    End If

    End Select

    Return Nothing
    Catch ex As Exception
    Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    End Try
    End Function


    Public Function GanttDataSet(ByVal si As SessionInfo, ByVal globals As BRGlobals) As DataSet
    Try
    Dim now As DateTime = DateTime.UtcNow
    Dim topLevel As New XFGanttTaskItem("Top Level task to appear", "Top Level Task to appear", "Top Level description to appear", WorkflowStatusTypes.Completed, XFImageFileSourceType.Unknown, "", now, now.AddDays(2), SharedConstants.DateTimeMinValue, False, 80.0, True, "", Nothing, Nothing)

    Dim dependencies As New List(Of String)()
    dependencies.Add(topLevel.UniqueName)
    Dim dependentTask1 As New XFGanttTaskItem("DT1", "Dependant task 1 to appear", "Dependant task 1 description", WorkflowStatusTypes.Unknown,XFImageFileSourceType.SystemDatabaseFile, "StatusOrangeBall", now.AddDays(2).AddHours(8), now.AddDays(4), SharedConstants.DateTimeMinValue, False, 0.0, False, "", Nothing, dependencies)
    Dim dependentTask2 As New XFGanttTaskItem("DT2", "Dependent Task 2 to appear", "Dependant task 2 description", WorkflowStatusTypes.Unknown,XFImageFileSourceType.SystemDatabaseFile, "StatusOrangeBall", now.AddDays(2).AddHours(8), now.AddDays(4), SharedConstants.DateTimeMinValue, False, 0.0, False, "", Nothing, dependencies)

    dependencies = New List(Of String)()
    dependencies.Add(dependentTask1.UniqueName)
    dependencies.Add(dependentTask2.UniqueName)
    Dim lastTask As New XFGanttTaskItem("LastTask", "Last Task to appear", "Last Task description", WorkflowStatusTypes.InProcess, XFImageFileSourceType.Unknown, "", now.AddDays(5), now.AddDays(7), SharedConstants.DateTimeMinValue, False, 0.0, True, "", Nothing, dependencies)

    Dim reviewMilestone As New XFGanttTaskItem("Review", "Review to appear", "Last Task description", WorkflowStatusTypes.NotExecuted, XFImageFileSourceType.Unknown, "" ,now.AddDays(7), now.AddDays(7).AddHours(1), SharedConstants.DateTimeMinValue, True, 0.0, False, "", Nothing, Nothing)

    Dim children As New List(Of XFGanttTaskItem)()
    children.Add(topLevel)
    children.Add(dependentTask1)
    children.Add(dependentTask2)
    children.Add(lastTask)
    children.Add(reviewMilestone)
    Dim summaryTask1 As New XFGanttTaskItem("SummaryTask1", "Summary Level Task to appear", "Summary Level description", WorkflowStatusTypes.Unknown,XFImageFileSourceType.Unknown, "", now, now.AddDays(7), SharedConstants.DateTimeMinValue, False, 0.0, False, "", children, Nothing)

    Dim tasks As New List(Of XFGanttTaskItem)()
    tasks.Add(summaryTask1)
    Dim ganttCollection As New XFGanttTaskCollection(tasks)

    Return ganttCollection.CreateDataSet(si)

    Catch ex As Exception
    Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    End Try
    End Function

    End Class
    End Namespace
     
  • ChristianW's avatar
    ChristianW
    Valued Contributor

    Hi Sergey

    We are working on improving our documentation for developers. Till we got everything covered, the market place is a great source of knowledge.

    I learned a lot of interesting advanced concepts just by analyzing marketplace solutions. 

    The gantt component is used in the task scheduler marketplace solution. If you download an old version, the business rules are not encrypted and still accessible.

    Load it to an empty application and have a look.

    Good luck.

    • Sergey's avatar
      Sergey
      Contributor III

      Thanks Christian,

      For those interested, here's a bot of code I received that is a starting point for the Gantt component :

      Imports System
      Imports System.Collections.Generic
      Imports System.Data
      Imports System.Data.Common
      Imports System.Globalization
      Imports System.IO
      Imports System.Linq
      Imports System.Windows.Forms
      Imports Microsoft.VisualBasic
      Imports OneStream.Finance.Database
      Imports OneStream.Finance.Engine
      Imports OneStream.Shared.Common
      Imports OneStream.Shared.Database
      Imports OneStream.Shared.Engine
      Imports OneStream.Shared.Wcf
      Imports OneStream.Stage.Database
      Imports OneStream.Stage.Engine

      Namespace OneStream.BusinessRule.DashboardDataSet.GANTT
      Public Class MainClass
      Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object
      Try
      Select Case args.FunctionType

      Case Is = DashboardDataSetFunctionType.GetDataSetNames
      Dim names = New List(Of String)()
      names.Add("GanttDataSet")
      Return names

      Case Is = DashboardDataSetFunctionType.GetDataSet

      If args.DataSetName.XFEqualsIgnoreCase("GanttDataSet") Then
      Return Me.GanttDataSet(si, Globals)
      End If

      End Select

      Return Nothing
      Catch ex As Exception
      Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
      End Try
      End Function


      Public Function GanttDataSet(ByVal si As SessionInfo, ByVal globals As BRGlobals) As DataSet
      Try
      Dim now As DateTime = DateTime.UtcNow
      Dim topLevel As New XFGanttTaskItem("Top Level task to appear", "Top Level Task to appear", "Top Level description to appear", WorkflowStatusTypes.Completed, XFImageFileSourceType.Unknown, "", now, now.AddDays(2), SharedConstants.DateTimeMinValue, False, 80.0, True, "", Nothing, Nothing)

      Dim dependencies As New List(Of String)()
      dependencies.Add(topLevel.UniqueName)
      Dim dependentTask1 As New XFGanttTaskItem("DT1", "Dependant task 1 to appear", "Dependant task 1 description", WorkflowStatusTypes.Unknown,XFImageFileSourceType.SystemDatabaseFile, "StatusOrangeBall", now.AddDays(2).AddHours(8), now.AddDays(4), SharedConstants.DateTimeMinValue, False, 0.0, False, "", Nothing, dependencies)
      Dim dependentTask2 As New XFGanttTaskItem("DT2", "Dependent Task 2 to appear", "Dependant task 2 description", WorkflowStatusTypes.Unknown,XFImageFileSourceType.SystemDatabaseFile, "StatusOrangeBall", now.AddDays(2).AddHours(8), now.AddDays(4), SharedConstants.DateTimeMinValue, False, 0.0, False, "", Nothing, dependencies)

      dependencies = New List(Of String)()
      dependencies.Add(dependentTask1.UniqueName)
      dependencies.Add(dependentTask2.UniqueName)
      Dim lastTask As New XFGanttTaskItem("LastTask", "Last Task to appear", "Last Task description", WorkflowStatusTypes.InProcess, XFImageFileSourceType.Unknown, "", now.AddDays(5), now.AddDays(7), SharedConstants.DateTimeMinValue, False, 0.0, True, "", Nothing, dependencies)

      Dim reviewMilestone As New XFGanttTaskItem("Review", "Review to appear", "Last Task description", WorkflowStatusTypes.NotExecuted, XFImageFileSourceType.Unknown, "" ,now.AddDays(7), now.AddDays(7).AddHours(1), SharedConstants.DateTimeMinValue, True, 0.0, False, "", Nothing, Nothing)

      Dim children As New List(Of XFGanttTaskItem)()
      children.Add(topLevel)
      children.Add(dependentTask1)
      children.Add(dependentTask2)
      children.Add(lastTask)
      children.Add(reviewMilestone)
      Dim summaryTask1 As New XFGanttTaskItem("SummaryTask1", "Summary Level Task to appear", "Summary Level description", WorkflowStatusTypes.Unknown,XFImageFileSourceType.Unknown, "", now, now.AddDays(7), SharedConstants.DateTimeMinValue, False, 0.0, False, "", children, Nothing)

      Dim tasks As New List(Of XFGanttTaskItem)()
      tasks.Add(summaryTask1)
      Dim ganttCollection As New XFGanttTaskCollection(tasks)

      Return ganttCollection.CreateDataSet(si)

      Catch ex As Exception
      Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
      End Try
      End Function

      End Class
      End Namespace