How can I access list elements dynamically and put it in a loop? I tried this:
index = 2
r = @Value(keys_list{index}.key)
but understand the 'at' is just a templating syntax and cant be used like this..
Also, if there is any specific list functions or a dedicated list object, I have not been able to find them under  Class FMEFeature in the documentation.
Thanks,
UPDATE:
Tried
        keys_list = feature.getAttribute('keys_list{}')
        for key in keys_list:
            pass       Â
        self.pyoutput(feature)
This gives me Python Exception <TypeError>: 'NoneType' object is not iterable
Verified: keys_list exists and has several elements.
Try something like
my_list = feature.getAttribute('attribute_list{}')
for item in my_list:
    print item
This will read the FME list "attribute_list{}" into the Python list "my_list", then iterate and print each element in that list.
If you have a complex list, it would look like this:
my_list = feature.getAttribute('attribute_list{}.item_name')
for item in my_list:
    print item
Try something like
my_list = feature.getAttribute('attribute_list{}')
for item in my_list:
    print item
This will read the FME list "attribute_list{}" into the Python list "my_list", then iterate and print each element in that list.
If you have a complex list, it would look like this:
my_list = feature.getAttribute('attribute_list{}.item_name')
for item in my_list:
    print item
Thanks, still cant get it to work though, pls check update in question.
Â
Â
my_list = feature.getAttribute('attribute_list{}.key')
for item in my_list:   Â
print item
Â
Hi @giskisÂ
You have to specify which element of the list you would like to load.Â
The error occurs when the specified list doesn't exist. If 'keys_list' is the base name of a complex list (i.e. a list consisting of one or more components such as keys_list{}.key), you will have to qualify the list name with a component name. e.g. 'keys_list{}.key'.
Try:
keys_list = feature.getAttribute('keys_list{}.key')
if keys_list:
    for key in keys_list:
        print key
my_list = feature.getAttribute('attribute_list{}.key')
for item in my_list:   Â
print item
Â
Hi @giskisÂ
You have to specify which element of the list you would like to load.Â
Thanks, nailed it!
Â
Â
Hello,
I have a set of point and a grid partition. each point is assign to a partition
I have build a list containing all point in a partition (listbuilder group by partition_id)
Is there a way to get the feature geometry of each element of the list.
Does the geometry is preserved in a listbuilder ?
if so How can I retreive it within the list of element in python?
so far I only get NoneType in my_list.

def input(self, feature):
    my_list = feature.getAttribute("_list{}")
    # flush the list
    self.fList = e]
    if my_list is not None and len(my_list) > 0:
        for item in my_list:
            new_feature = feature.clone()
            self.fList.append(new_feature)
        self.DBScan(self.fList, self.eps, self.minPts)
    else:
        partition = feature.getAttribute("partition")
        self.logger.logMessageString("partition {} as no value : ".format(partition) , fmeobjects.FME_ERROR)
Thank
Sylvain
Try:
keys_list = feature.getAttribute('keys_list{}.key')
if keys_list:
    for key in keys_list:
        print key
Hello,
I have a set of point and a grid partition. each point is assign to a partition
I have build a list containing all point in a partition (listbuilder group by partition_id)
Is there a way to get the feature geometry of each element of the list.
Does the geometry is preserved in a listbuilder ?
if so How can I retreive it within the list of element in python?
so far I only get NoneType in my_list.

def input(self, feature):
    my_list = feature.getAttribute("_list{}")
    # flush the list
    self.fList = ]
    if my_list is not None and len(my_list) > 0:
        for item in my_list:
            new_feature = feature.clone()
            self.fList.append(new_feature)
        self.DBScan(self.fList, self.eps, self.minPts)
    else:
        partition = feature.getAttribute("partition")
        self.logger.logMessageString("partition {} as no value : ".format(partition) , fmeobjects.FME_ERROR)
Thank
Sylvain
Try:
keys_list = feature.getAttribute('keys_list{}.key')
if keys_list:
    for key in keys_list:
        print key
Hello,
I have a set of point and a grid partition. each point is assign to a partition
I have build a list containing all point in a partition (listbuilder group by partition_id)
Is there a way to get the feature geometry of each element of the list.
Does the geometry is preserved in a listbuilder ?
if so How can I retreive it within the list of element in python?
so far I only get NoneType in my_list.

def input(self, feature):
    my_list = feature.getAttribute("_list{}")
    # flush the list
    self.fList = ]
    if my_list is not None and len(my_list) > 0:
        for item in my_list:
            new_feature = feature.clone()
            self.fList.append(new_feature)
        self.DBScan(self.fList, self.eps, self.minPts)
    else:
        partition = feature.getAttribute("partition")
        self.logger.logMessageString("partition {} as no value : ".format(partition) , fmeobjects.FME_ERROR)
Thank
Sylvain