Renaming columns
Hi - I am trying to rename a column called 1 using the Transform node with the following script within the ConfigureFields section:
out1.EXTERNAL_ORGANISATIONAL_UNIT_ID = in1.EXTERNAL_ORGANISATION_UNIT_ID
out1.ATTRIBUTE_1 = in1.[1]
I have lots of differing ways but the same error occurs - what am i doing wrong?
mismatched input '[' expecting set null Error in "ConfigureFields" at line "5", column "23" in text: out1.ATTRIBUTE_1 = in1.[1]
Many Thanks
Martin
-
Hi Martin,
The issue is that the input field specification is a hybrid of two possible formats. Dataverse allows the field metadata to be specified using:
out1.MyOutputField = in1.FieldName
where 'FieldName' does not conflict with a Python keyword and does not contain space characters, or
out1.MyOutputField = in1['Field Name']
In your situation in1.[1] should be in1['1'] - i.e. there is no period '.' character before the opening square bracket. Note also the use of apostrophes around the field name as the field name is a string in this case.
In addition you can use a variable in the specification, e.g.
RequiredField = '1'
out1.MyOutputField = in1[RequiredField]
Best regards,
Adrian
-
You may also be interested in the 'Rename Fields' Community custom node here:
https://lavastorm.zendesk.com/hc/en-us/community/posts/115001574994-Rename-Fields-Custom-Node
Please sign in to leave a comment.
Comments
2 comments