Hi,
I have created a series of Dictionaries in the PythonCaller and I want to output the Key and Value pairs as new attributes with values for each feature.
Is there syntax using feature.setAttribute to do this?
Hi,
I have created a series of Dictionaries in the PythonCaller and I want to output the Key and Value pairs as new attributes with values for each feature.
Is there syntax using feature.setAttribute to do this?
Try something like this
for key, value in mydict.items():
feature.setAttribute(key, value)
for k,v in d.items():
feature.setAttribute(k,v)
Note that you will have to explicitly expose the attributes to use them in the workspace
Try something like this
for key, value in mydict.items():
feature.setAttribute(key, value)
Thanks! The only issue is I won't know the name of the keys since they are created as part of the code. Is there anyway to expose them without knowing what they are called?
Thanks! The only issue is I won't know the name of the keys since they are created as part of the code. Is there anyway to expose them without knowing what they are called?
Thanks! The only issue is I won't know the name of the keys since they are created as part of the code. Is there anyway to expose them without knowing what they are called?
My overall issue is that I have a number of lists. Inside one of the lists is the values that I would like to use as column headers in an excel spreadsheet and the values that will be under the column headers can be found in another one of the lists. I can't work out how to make the values in the list into column headers.
Perhaps there is another way to do this??
My overall issue is that I have a number of lists. Inside one of the lists is the values that I would like to use as column headers in an excel spreadsheet and the values that will be under the column headers can be found in another one of the lists. I can't work out how to make the values in the list into column headers.
Perhaps there is another way to do this??
My overall issue is that I have a number of lists. Inside one of the lists is the values that I would like to use as column headers in an excel spreadsheet and the values that will be under the column headers can be found in another one of the lists. I can't work out how to make the values in the list into column headers.
Perhaps there is another way to do this??
Thanks! The only issue is I won't know the name of the keys since they are created as part of the code. Is there anyway to expose them without knowing what they are called?
And when I set the Excel Writer Schema Sources to "Schema From Schema Feature" I am outputting an excel spreadsheet with the new column headers as I required.
However, I can't work out how to populate these column headers! I tried to populate them in AttributeManager like so:
But then in the excel spreadsheet the values of the column headers replaced the column headers themselves.
I seem to be missing one vital step here but I can't work out what it is.
Thanks,
And when I set the Excel Writer Schema Sources to "Schema From Schema Feature" I am outputting an excel spreadsheet with the new column headers as I required.
However, I can't work out how to populate these column headers! I tried to populate them in AttributeManager like so:
But then in the excel spreadsheet the values of the column headers replaced the column headers themselves.
I seem to be missing one vital step here but I can't work out what it is.
Thanks,
Thanks! The only issue is I won't know the name of the keys since they are created as part of the code. Is there anyway to expose them without knowing what they are called?
I tried posting as a new question but there is an issue with my computer and screen shots are not working for some reason.
https://knowledge.safe.com/questions/56136/creating-a-schemafeature-and-mapping-values-to-it.html?
In essence my problem is now that I can create the new column headers using the Attribute Creator with the parameters as such:
New
Thanks,
I tried posting as a new question but there is an issue with my computer and screen shots are not working for some reason.
https://knowledge.safe.com/questions/56136/creating-a-schemafeature-and-mapping-values-to-it.html?
In essence my problem is now that I can create the new column headers using the Attribute Creator with the parameters as such:
New
Thanks,
Thanks! The only issue is I won't know the name of the keys since they are created as part of the code. Is there anyway to expose them without knowing what they are called?
The functions inside the Attribute Value field in the AttributeCreator are being calculated correctly. I was able to create new attributes based on those functions. But my problem is that I can't populate the new attributes that were created with any values.
Thanks
The functions inside the Attribute Value field in the AttributeCreator are being calculated correctly. I was able to create new attributes based on those functions. But my problem is that I can't populate the new attributes that were created with any values.
Thanks