List matching - how to keep using the same data order in two lists

Hello everyone,
I’ve used the node Element.HostElement-ArchiLab from ArchiLab package, to filter out the curtain panels hosts.
The issue now is that the given results are ignoring the previous list’s data order, so it is kind of difficult to understand which list related to which list…

So as you can see, the first list has 4908 sub-lists, but the second one has only 771 lists.

How could I keep the same data order from the first list and applies to the second one?

Thanks in advance

Hello, could you enlarge your screenshot? This one is not enough to understand how you get this list of empty items…

Node from Archilab clearly skips empty lists, so maybe remove empty/null before this node. Otherwise show paste python code from hostElement node

Here is the whole process, basically the target was to group curtain panels by their associated rooms from linked files.

Thanks for your reply!

I’d like to keep the same sublists number without flatting, till the export later as an Excel file.
Here is the code from hostElement node:

#Copyright© 2015, Konrad K Sobon

@arch_laboratory, http://archi-lab.net

import clr
import sys

pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)

Import Element wrapper extension methods

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

Import DocumentManager and TransactionManager

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

Import RevitAPI

clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

if isinstance(IN[0], list):
elements = []
for i in IN[0]:
elements.append(UnwrapElement(i))
else:
elements = IN[0]

def GetHostElement(element):
doc = DocumentManager.Instance.CurrentDBDocument
try:
host = element.Host
return host
except:
try:
hostIds = []
for i in element.GetHostIds():
hostIds.append(doc.GetElement(i))
return hostIds
except:
return None

def ProcessList(_func, _list):
return map( lambda x: ProcessList(_func, x) if type(x) == list else _func(x), _list )

try:
errorReport = None
if isinstance(elements, list):
output = ProcessList(GetHostElement, elements)
else:
output = GetHostElements(elements)
except:

if error accurs anywhere in the process catch it

import traceback
errorReport = traceback.format_exc()

#Assign your output to the OUT variable
if errorReport == None:
OUT = output
else:
OUT = errorReport