12-02-2021 07:47 AM
Hi,
Suppose that in my Data Portal there is a group (e.g. "Group Test") containing a time channel ("Group Test/time") and several XY Channels ("Group Test/Var00", "Group Test/Var01", etc.)
I would like to create a new XY Channel associated to "Group Test/time". It should be added to the same Group. This new Channel of course hs the same length as all the other channels of that group.
I am able to create a channel, but I cannot associate to the time reference
# Create Channel. OK
dd.ArrayToChannels(outX, ['Group Test/calcChan'])
# Associate calculated channel with X-Reference. KO
dd.Data.Root.ChannelGroups('Group Test').Channels('calcChan').XRelation = 'time'
Running the script above, I get the error message "AttributeError: Property '<unknown>.XRelation' can not be set."
Is there a way to do it? Many thanks
Solved! Go to Solution.
12-03-2021 08:13 AM
I figured it out! In case someone else will need it, that's how I did it.
# Create Channel. OK
dd.ArrayToChannels(outX, ['Group Test/calcChan'])
# Associate calculated channel with X-Reference. KO
dd.Data.Root.ChannelGroups('Group Test').Channels('calcChan').xRelation = dd.Data.Root.ChannelGroups('Group Test').Channels('time')
Basically I shouldn't associate a text string, but a channel.