Calculating start and end dates of a hierarchy based task items.

Let's say I have a list of task items(not to be confused with Appian tasks) defined in a list of dictionary which are configured like below.

{
  {
    task: "A",
    sla: 5,
    precedentTasks: null
  },
  {
    task: "B",
    sla: 10,
    precedentTasks: null
  },
  {
    task: "C",
    sla: 7,
    precedentTasks: "B"
  },
  {
    task: "D",
    sla: 3,
    precedentTasks: "B,C"
  },
  {
    task: "E",
    sla: 5,
    precedentTasks: "D"
  },
  {
    task: "F",
    sla: 10,
    precedentTasks: "D,E"
  },
  {
    task: "G",
    sla: 7,
    precedentTasks: "F"
  }
}

Tabular version of the same data;

Which means,

Task C cannot be launched until Task B is completed,

Task D cannot be launched until both Task B and C are completed,

And go on ...

These task items are generated per case, so the logic should be able to handle any type of data structure.

For a given start date, how do I calculate the start date and end date of each task based on the SLA defined and also complying with the dependency hierarchy shown in the image above?

  Discussion posts and replies are publicly visible

  • I'm assuming

    1. Each task is tied to some central record

    2. That a task history is kept for that central record

    Then you could do something like this:

    choose(
      wherecontains(
        ri!taskType,
        {
          "A",
          "B",
          "C",
          "D",
          "E",
          "F",
          "G"
          
        }
      ),
      /*"A",*/
      now() + 5,
      /*"B",*/
      now() + 5,
      /*"C",*/
      if(
        contains(
          ri!taskHistory,
          "A"
        ),
        now() + 7,
        null
      ),
      /*"D",*/
      if(
        and(
          contains(
            ri!taskHistory,
            "A"
          ),
          contains(
            ri!taskHistory,
            "B"
          )
        ),
        now() + 3,
        null
      ),
      /*"E",*/
      if(
        contains(
          ri!taskHistory,
          "D"
        ),
        now() + 5,
        null
      ),
      /*"F",*/
      if(
        contains(
          ri!taskHistory,
          "D"
        ),
        now() + 10,
        null
      ),
      /*"G"*/
      if(
        contains(
          ri!taskHistory,
          "F"
        ),
        now() + 7,
        null
      )
    )

    Basically, pass in the Task Type (A, B, C, D etc) of the current task, along with the task history.

    For tasks that have precedents, check to see if the task history contains the relevant precedents.

    Hope this helps.

  • 0
    Certified Lead Developer
    in reply to anon897987

     Thank you for the response!

    I have edited the question, please refer to the latest. Thank you!