Get the last element in a list

What I’m trying to do

I have a file.tag property that holds the type of the particular note. This tag is nested like below.

I’m trying to use DataView create a table with the file’s type i.e. the deepest tags - audio, book, MoM, etc.

Things I have tried

split(file.etags[0],"/")[2] AS "Type"

This is how I’m currently getting the final type, but I would like to,

  1. Get the last element of the array directly so that I wouldn’t get a null incase the type contained only 1 level of nesting.
  2. (Bonus doubt but not very important) If there happened to be a note that contains two tags, I need to get the last elements of both.