Skip to main content
August 17, 2022
Solved

Condition on the List

  • August 17, 2022
  • 5 replies
  • 0 views

Hi, 

I want to check if the status is Start/ In Progress  or Completed.

1. if the list is  {"Start"; "Start"; "Start"}, result would be Start

2. if the list is  {"Start"; "In Progress"; "Start"} or any combination that the values are not the same, result would be In Progress

3. if the list is  {"Completed"; "Completed"; "Completed"}, result would be Completed.

please help.

Thanks,

Best answer by csteward

For this I am assuming the second #2 (#3?) should result in "Completed"?  If so:

a!localVariables(
  local!list: {"Start","Start","Start"},
  local!union: union(local!list,local!list),
  
  if(
    local!union="Start",
    "Start",
    if(
      local!union="Completed",
      "Completed",
      "In Progress"
    )
  )
)

5 replies

csteward
cstewardAnswer
August 17, 2022

For this I am assuming the second #2 (#3?) should result in "Completed"?  If so:

a!localVariables(
  local!list: {"Start","Start","Start"},
  local!union: union(local!list,local!list),
  
  if(
    local!union="Start",
    "Start",
    if(
      local!union="Completed",
      "Completed",
      "In Progress"
    )
  )
)

August 17, 2022

Hey Chris, I think it should be started only if all the statuses are started else it will be In-Progress.

a!localVariables(
  local!statuses: { "Completed", "Completed", "Completed" },
  if(
    union(local!statuses, local!statuses) = "Start",
    "Start",
    "In-Progress"
  )
)

csteward
August 17, 2022
Hey Chris, I think it should be started only if all the statuses are started else it will be In-Progress.

My logic is under the assumption that the initial post intended to indicate {"Completed","Completed","Completed"}="Completed", instead of "In Progress" - we will need the OP to confirm.