Validation for string on Allen-Bradley Read node tag

Hello Losant Support!

I have an application that needs to collect data from Allen-Bradley PLC’s with varying tag names. I have setup a workflow that utilizes a function to built an array of the tags, keys, types, and program required for the Allen-Bradley: Read node. This works successfully when run on a small subset of tags, however when I expand it to the full list, it fails on a “tag name must be a valid string” error. I am guessing that the Allen-Bradley: Read node does not like the format of one of the tag strings, but I cannot determine which one it is (I have removed anything obvious).

Are there any guidelines on the string requirements for the Allen-Bradley: Read node? Do you have any recommendations on how to appropriately validate the string before placing it into the array? Or, is there a way to get the Allen-Bradley: Read node to run on the tags that it can validate and omit the ones it cannot?

Here is the function that is building the array in case it may be useful.

var i = 0
let retArray = []
payload.plcDevice.value.attributes.forEach(getElements)
payload.data = retArray

function getElements(element){
  if (typeof element.attributeTags.plcTagName != 'undefined'){
  retArray[i] = 
  {
    "key": element.name,
    "tag":element.attributeTags.plcTagName,
    "program":"",
    "type": element.attributeTags.plcDataType
  }
  }
  i = i + 1
}

Hey @Michael_Murdy,

Would any of your tag names happen to have a colon (:), spaces, or other special characters in them?

An option you do have, too, is to test your tag names in the Controller or Program Tag Template field in the Allen-Bradley: Read Node.

Are there any guidelines on the string requirements for the Allen-Bradley: Read node? Do you have any recommendations on how to appropriately validate the string before placing it into the array?

Currently, we do not, but I will work on making this available.

Or, is there a way to get the Allen-Bradley: Read node to run on the tags that it can validate and omit the ones it cannot?

This is a great idea. I will add this as a feature request and be sure to let you know more as I learn more about it.

Thank you,
Heath

Thanks for the quick response Heath! I had not identified any special characters in my review last night. I will go through it again. There are underscores, but I believe those are allowed. There were a few tags with periods as well. I believe those are allowed as well, but if you could confirm, it would be appreciated.

I’ll start down the list of tags, copying them into the node to see which one may be causing the problem. Great idea on that front!

Let me know if/when you are able to get the string requirements published for this node.