Converting a string to a string array using split()

Hi Ignition Forum,

I have a string coming in over TCP from an RFID reader that I’m looking to parse into an array. I’m testing some code in the Script Console and running into a problem I wouldn’t expect. Here is my code:

from string import split
# Read in the TCP tag.
reader1 ="[default]JBS Truck Tracking/14150/Message")


# Convert the string into a StringArray.
string_array = reader1.split(',')

# Write the array to Reader1Array
system.tag.write('[default]JBS Truck Tracking/Reader1Array', string_array)

The import works fine, no error. The works fine, no error. The print works fine, no error. When I try to use the .split() function, I get:

Traceback (most recent call last):
  File "<buffer>", line 8, in <module>
AttributeError: 'com.inductiveautomation.ignition.common.sqltags.Ba' object has no attribute 'split'

I’ve tried various implementations of the split function because I’m not 100% sure which one to use, every time I receive the AttributeError though. Here are some other formats I’ve tried:

string_array = reader1.split(reader1, ',')
string_array = string.split(reader1, ',')

All ideas are good ideas! Thank you in advace!

The read returns a qualifiedValue, so it has the value as well as a quality and timestamp.

Try reader1.value.split(’,’)


Ahhhh that was it! I knew it must be something simple. Thanks so much!