LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excluding alarm URLs from a Shared Variable search

(LabView 12.0.1f3)

Hi,

I am querying a large number of local Shared Variables (and would also like to be able to add/remove variables from the project libraries without editing constants), so in order to programatically generate their URLs I have tried using the "Search Variable Container" VI or the "Variable Container.AllVariables[]" property node. However, if a Shared Variable includes Alarms, then the ".../VariableName/Alarms/Boolean/..." URLs will also be passed out for each alarm!

 

I have noticed that the "Get Shared Variable List" VI from the DSC toolkit does generate an array of only the Shared Variables, however these are output as I/O type "Network Variable (BV Tag)", whereas functions such as the "Read Variable" VI require a "Variable [Variable], ...] variant type. 

 

Is there a way to exclude the children alarm URLs from a search in a Variable Container, or a way to use the clean DSC variable list to read/write Shared Variable values? Thanks,

 

  --David

0 Kudos
Message 1 of 6
(2,950 Views)

I, too, would like to know the answer.

 

For the special case where I was searching by suffix, I used the end-of-string regex anchor. For example, (suffix1$|suffix2$) will return all variables that end with "suffix1" or "suffix2", which will exclude the alarms

Certified LabVIEW Developer
0 Kudos
Message 2 of 6
(2,935 Views)

I did consider adding a suffix to all of the variable names, but I am hoping there is a more elegant solution that I'm missing, like typecasting or a seond type of SV Read function.

 

  --David

0 Kudos
Message 3 of 6
(2,924 Views)

Hi all,

 

I was able to get a list of URLs using the code in the VI snippet below. I created a variable with an alarm and purposefully triggered it to be sure it wouldn't show up and I only got the URLs of variables, no alarms. Was this what you were after?

VariableURLs.png

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 4 of 6
(2,907 Views)

Miles,

Thanks for that, I see it does generate URLs without the alarms. However, perhaps I was using URL a little too loosely, as I don't know if they in themselves are helpful. The "Get Shared Variable List.vi" in your example also produces a list of variables without alarms, but is there a way to use either output to programmatically read the SV current values?

 

  --David

0 Kudos
Message 5 of 6
(2,891 Views)

David,

 

You can take these URLs and feed them into an Open Tag Reader.vi located in Functions >> DSC Module >> Tags, and feed the tag reader into a Read Tag.vi located on the same palette. The Read Tag VI is a polymorphic VI that you'll have to select an instance of. You can probably accomplish your task by using the SharedVariableIO property node in my last example, expanding it to have a data type output as well, and then using the enum from this to act as a case selector for a case structure with all the expected data types you think you will get as separate cases.

 

Does that sound manageable?

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 6 of 6
(2,871 Views)