Showing a list in a label

Good afternoon. I have an expression tag that looks at the boolean status of a tag and adds them together to get a total of how many are off/0:

{[.]2/Cobot OPC Tags/OPC_Status}+
{[.]3/Cobot OPC Tags/OPC_Status}+
{[.]4/Cobot OPC Tags/OPC_Status}+
{[.]5/Cobot OPC Tags/OPC_Status}+
{[.]6/Cobot OPC Tags/OPC_Status}+
{[.]7/Cobot OPC Tags/OPC_Status}+
{[.]8/Cobot OPC Tags/OPC_Status}+
{[.]9/Cobot OPC Tags/OPC_Status}+
{[.]10/Cobot OPC Tags/OPC_Status}+
{[.]11/Cobot OPC Tags/OPC_Status}+
{[.]12/Cobot OPC Tags/OPC_Status}+
{[.]13/Cobot OPC Tags/OPC_Status}+
{[.]14/Cobot OPC Tags/OPC_Status}+
{[.]15/Cobot OPC Tags/OPC_Status}+
{[.]16/Cobot OPC Tags/OPC_Status}+
{[.]17/Cobot OPC Tags/OPC_Status}+
{[.]18/Cobot OPC Tags/OPC_Status}+
{[.]19/Cobot OPC Tags/OPC_Status}+
{[.]20/Cobot OPC Tags/OPC_Status}+
{[.]21/Cobot OPC Tags/OPC_Status}+
{[.]22/Cobot OPC Tags/OPC_Status}+
{[.]23/Cobot OPC Tags/OPC_Status}+
{[.]24/Cobot OPC Tags/OPC_Status}+
{[.]25/Cobot OPC Tags/OPC_Status}+
{[.]27/Cobot OPC Tags/OPC_Status}+
{[.]28/Cobot OPC Tags/OPC_Status}+
{[.]29/Cobot OPC Tags/OPC_Status}+
{[.]30/Cobot OPC Tags/OPC_Status}+
{[.]31/Cobot OPC Tags/OPC_Status}+
{[.]32/Cobot OPC Tags/OPC_Status}

image

Is there a way for me to see which ones are of those 7 in an off/0 state, like a list of them? I.e. cobot 2, cobot 5, etc..? in a label.

I would use my Integration Toolkit's tags() and where() functions to monitor those tags and post-process the list to prune out the ones that are OK.

Phil, can you share a link to that for me?

1 Like

I recommend using two tags for future convenience. One dataset memory tag to hold the list of tag names to monitor, and one dataset expression tag to hold the pruned result. There's one nuance to deal with: dataset tags are not allowed to have columns of type Object, which is what you get from tags(), since it potentially must handle tags of many different data types.

The tag holding tag names needs to be just a single string column. The [.] syntax is allowed. Say it is called OPC_Status_List.

The expression tag would have this:

where(
	unionAll(
		asMap('Tag', 'str', 'Status', 'B'),
		tags({[.]OPC_Status_List})
	),
	!it()[1] // Return rows where the second column is not boolean true.
)

The unionAll() coerces each row to be a string and a boolean, instead of a string and an Object.

What is 'B' in this case?

It is the datatype to use for the 2nd column: Boolean. I use the same conventions as IA: