getting the second item on a list to commit an action

    I am currently trying to get a second item to off the first list to filter the second list.  I am able to get the first item using head , i try using tail operation then head operation again to get the second item from the list. however the results only show for the first item even if i have more then one item on the list.  any advise or help is appreciated   thank you for time and help   
2 answers

Head or Tail operation will not modify the original list (the element is not removed from the list), only you get it as a separate object. So subsequent operations after head/tail does not make any effect as is the item was removed from list. 

To get the second item in list, there could be multiple approaches:

  • Take head object, create a list with 1 element having this object. Now subtract this list from original list. You have the new list minus head, again take head object to have second object
  • Loop through list, use a index variable and upon reaching 2nd element, just copy it by create object activity. Thats your second element object. 
  • Take head object. Use change list and remove head object from list. Now again take head object. 

This would probably work

if you have taken the head from 'NewValueStreamList’. Instead I think your head-activity takes the head of the original 'ValueStreamList’. So that would explain your unexpected results.

However you solve this puzzle, it would make easier reading  and easier testing if you do this in a subflow that you call ValueStreamList_GetSecondItem. In this subflow you can also better handle lists containing less than 2 objects.