10-18-2018 03:52 PM
I am looking for a way to allow a user to enter some data using a control type that is not known at design time, but which is of the same type as an indicator in a user supplied VI (not known until run time). The indicator may be a complex type such as a cluster, array of clusters, etc. My application will run the user supplied VI and then perform limit checks on the VI's output indicator. The user needs to be able to enter the limits at run time. I have tried a couple of approaches to try to solve this problem, but am running into problems with each approach.
1. A reference to the user VI is opened using option 8 (prepare for reentrant run) and the VI is inserted into two subpanels, one for the lower limit and one for the upper limit. The idea is for the user to set the limits here. Dynamic value change events for the indicator are registered so that it can be detected when the user makes a change (without using polling). The user entered data will be returned as a variant, which is fine. This works if the control on the user VI is a "Control", but the problem is that it is not settable by the user if it is an "Indicator" when option 8 is used. See Snippet 1.PNG
2. A reference is created like in 1. above, but the default option is used when opening the reference. Since the VI will be inserted in multiple subpanels simultaneously and the reference is not opened as reentrant, a copy of the VI was made by saving it in a temp file with a different name (references are opened to two VIs with different names). When the references are opened this way, the indicator values can be changed by the user (the VI is not running). The problem is that it is not possible to register value change events for the indicators in this case - error 1027 occurs (see Error.PNG).
How can I allow the user to enter this data when the type is not known at design time?
Solved! Go to Solution.
10-18-2018 04:33 PM
Simple answer is that you can't enter data from the front panel into an indicator. If the user will be entering the data on the front panel it must be a control.
10-18-2018 04:50 PM
Is there some way around this - to present the user with a control that looks like the indicator, but which they can use to enter values? For instance is there a way to create a control of the same type as the indicator (without using VI scripting), or to temporarily change the indicator to a control. Alternately, is there a way to get a value change event in approach 2. in my original post? It looks like approach to works if I abandon the event structure and read the user entered values using polling, but this is not as nice a solution as using events.
10-18-2018 04:56 PM
A user cannot enter a value into an indicator. Why are you trying to use an indicator as an input on the FP? Use a control.
10-18-2018 06:42 PM
Can you explain (clearly) what you want to do? You seem to be hung up on "how" to do it, but I, for one, do not have any good idea what you want to do. Don't worry about mechanism -- as Mark has tried to explain, you enter values in controls, not indicators.
Without reference to controls, indicators, LabVIEW mechanics, etc., what's the idea you want to convey? [Also, what version of LabVIEW are you using? That will impact the "How"].
What is the task? What is an example of calling a sub-VI and trying to give it a value of unspecified Type? Is this something a Variant can handle (oops, that's a "How", not a "What"). Is this an LVOOP situation?
Bob Schor
10-18-2018 07:15 PM
I'll try to clarify what I am trying to accomplish. The application I am writing is a test sequencer, which controls the execution of a set of user supplied test VIs, records the test results (the value of their "Output value" indicator), checks the results of individual user tests against limits to determine whether the test passes or fails, etc. Prior to executing the user test VIs, the user configures how the tests will execute by specifying the order of the user tests, input parameters for the tests, and what limit checks are applied including the upper and lower bounds for limit checks.
My problem is with how to have the user enter the bounds for limit checks. As I mentioned previously, the "results" of a user test are the value of its "Output value" indicator. The test sequencer runs the user tests dynamically using a Run VI invoke node and then reads the value of the "Output value" indicator using a Ctrl Val.Get invoke node. The limit check compares the value of the "Output value" to the upper and lower bounds. The type of the "Output value", and thus the bounds, varies from user VI to user VI.
If the type of the output value was known at design time, then the solution would be simple, just provide the user with controls of the correct type to enter the upper and lower bounds. The "Output value" can be of any type though: numeric, string, cluster, array, array of clusters, etc.
So, the problem is: How can I enable the user to enter upper and lower bounds for a limit check where the type of the bounds matches the type of the "Output value" indicator and the type of the "Output value" is not known until runtime, but can be determined from the user test VI.
10-18-2018 07:28 PM
I'm using LabView 2015 and LVOOP, but the user test VIs are not LVOOP for the purposes of this issue. The "Output value" indicator in the user test VI is a cluster with contents that are not known ahead of time.
10-18-2018 08:55 PM
One of the most important things you can have in a test suite is to present the operator with a consistent experience. What you seem to be doing is just the opposite. You want all your tests to behave the same way and with the same "look". This way, the operator doesn't have to "guess" how something works. The button to start the test is always in the same location and it always looks the same. Anything that needs to be filled out always looks the same.
10-19-2018 12:51 AM - edited 10-19-2018 12:52 AM
Hi cbf,
The "Output value" indicator … is a cluster with contents that are not known ahead of time.
Unless you use variants the cluster type is known at edit time - that's an implication of DATAFLOW! (LabVIEW is a strictly typed language.)
Can you provide an example VI demonstrating your issues/problems?
10-19-2018 10:51 AM
Thank you for explaining What you want the user to do. If you read what you wrote, you might see the silliness in the "problem" you are hoping to solve. Here's an example:
Does this sequence make sense? Of course not -- how can you specify limits if you don't know the test you are going to run? If you simply invert the order, i.e. ask the User What he or she wants to do, you can then tailor the question about limits knowing the test, and hence the format for the limits. So if the Limits are a numeric range, you can ask for "Low" and "High" values. If the limits are a specific set of values, you can ask for acceptable values. If the limits are "Last names starting with a specific letter", you can ask for that letter.
Once you know what you want to do, figuring out how to do it becomes much simpler.
Bob Schor