Hello All,
There are a lot of questions around this topic (ie., https://knowledge.safe.com/questions/51878/how-to-setattribute-lists-in-pythoncaller.html), but somehow I'm not able to make it work. Here is the background:
I have an xml that I'm reading it and getting some attributes to pass them in FME for further processing. I have created a list of dict in order to group them, below is the code I'm using:
domain.append({'chartnumb_value':chartnumb_value,
'nm_numbers': get_chart_nm_numbers(update),
'region': get_region(update)})
print domain
Here is the print of the above::n{'nm_numbers': u'3040(P)/17', 'region': u'UNITED ARAB EMIRATES', 'chartnumb_value': u'Chart No: 8101'}]
'{'nm_numbers': u'3027(P)/17', 'region': u'BANGLADESH', 'chartnumb_value': u'Chart No: 8166'}]
2{'nm_numbers': u'3038(P)/17', 'region': u'AUSTRALIA', 'chartnumb_value': u'Chart No: AUS778'}]
I want to get the 'chartnumb_value', 'nm_numbers', and 'region' into separate columns. For this I'm using after the .append the following:
num_items = len(domain)
for i in range(num_items):
chartnumb_value = domainei]f"chartnumb_value"]
feature.setAttribute("_list{{{}}}".format(i), chartnumb_value
When I run the above code, I'm always getting one value, no matter if I append {} after the list in the attributes to expose (_list{}.chartnumb_value)
I've been going in a "loop" to find the solution, but is not working for me any solutions out there, probably (which is obvious) I'm missing something.
Thanks in advance for all your help on this
Cesar