From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Class ID to Value

So I hope I'm just missing something simple here.

I'm trying to monitor several event cases over an unknown number of VI's running in parallel (it varies with time). When an event is triggered, the reference to whatever triggered the event gets passed to a queue, which is read by another VI.

For now, I'm trying to convert the reference into a string of useful information (vi, control, value).

I know I can get information of the generic reference I'm reading in from the queue, but I'm wondering if there's an easy way of reading the Class ID from the reference and using that to convert the variant with data in it to a number, which can then be converted to a string. Or do I have to just write a subVI to match each number of the Class IDs to a data type in Variant to Data, and if I have to do that, is there a way to pull the representation information so I can cast it to the correct data type?

Would value signaling a reference from a different VI cause the event to trigger? (IE trigger reference from control a in VI A from within VI B)

I attached a small example of what I'm trying to do, but it's really incomplete... but hopefully gives a good idea of the plan!

I'm using LV 8.0.
0 Kudos
Message 1 of 5
(3,115 Views)
I forgot to mention that the VI I attached has preset screen coordinates on everything (I was investigating those a bit)

And also, on Top Level.vi, the stop button is the boolean in the background (stopping Top Level.vi stops everything)
0 Kudos
Message 2 of 5
(3,112 Views)
The way you are doing it now is going to be very difficult. You have to cast each class back to it's original class. You'll have to do this in a case structure for each class you are foing to use. Only after converting the classes to there original classes, you can use the properties of that class. This is asking for trouble, if you'd ask me. Or at least a lot of work.


You can send signal events to other VI's. Usually it is better to work with user events though, if the purpose is to notify other VI's.


If you register for dynamic events in the main event handling VI, you get all the information you need in the event structure. Then there is no need for queues anymore, and mixing queues with events would be very unintuitive.


Perhaps you better explain what you are trying to achieve, in stead of how you are trying to do it.


Regards,


Wiebe.
0 Kudos
Message 3 of 5
(3,086 Views)
I'm trying to write a scripting program.

Basically monitoring all the event cases currently used and keeping track of what events are triggered, then when the macro is completed, you can retrigger the old events to recreate what was done.

The idea is to fit it over what's already there, it's a big program with about 50 big VIs that run producer/consumer loops.  Rather than figuring out exactly what states are queued up in the producer loops for the consumer loops, I figured it'd be easier to monitor events and retrigger those events in the correct order.
0 Kudos
Message 4 of 5
(3,085 Views)
So let me see if I get this...


You have several large VI's. These VI's put the things they do on a queue (as a reaction on events). You put the control reference on this queue. You also monitor this queue, so you can replay it.


I'd try to put comprehensive information on the queue (e.g. an enum with a control ref and a variant) to begin with. This is a little more work everywhere you put things on the queue, but the program will be much easier to maintain.


Regards,


Wiebe.
0 Kudos
Message 5 of 5
(3,071 Views)