06-14-2011 04:47 PM
I am struggling trying to develop something with a few checkbox questions, a few user text input questions and some slider control questions. I have been struggling using the 'Configure Prompt User for Input" - I am thinking there must be a better way than using this? It doesn't seem to have the flexibility that I need (eg., restricting the number of choices the user can select). Any help would be really appreciated! Thanks so much.
06-14-2011 08:26 PM
This sounds like a really interesting use of LV!
1. Please show what you have tried. It is usually much easier to suggest improvements or modifications to an existing attempt than to put something together from a simple expression of what is wanted.
2. Can you be more specific about the types of questions (and answers)? How often do you need to change the text of the questions? Are the answers mutiple choice or essay? What do you mean by a slider control question? Is the slider the question or the answer? How will the answers be processed?
Lynn
06-14-2011 09:01 PM
Here is a sample of what i have been experimenting with - I am not really pleased with any of them so far... not the best solution I am sure...
06-14-2011 09:49 PM
I can see something of what you are trying to do.
Some comments after just a quick glance:
1. Use of stacked sequence structures is almost never a good way to set up a program. It obscures code and is very difficult to modify. Look at what you would need to do if you wanted to put question 3 after question 4. How easy would it be to make a mistake?
2. Learn about State machines. They are versatile, robust, easily modified, and generally good practice. Several examples and Design Patterns for state machines come with all recent versions of LV.
3. I will need some time to think about your controls issues.
4. You can edit the Express VIs. Just context-click on the icon and choose Open Front Panel. I have not looked at how they work but you can probably modify them to limit the responses.
Here is a quick modification which eliminates the sequence structures. To make a state machine from this is a short step.
Lynn
06-14-2011 10:25 PM
Believe it or not - I haven't had a chance to experiment with state machines but they look very powerful. I have looked at the examples of the event structures - but it wasn't obvious to me how to translate them to my present structure... the sequence structure seemed logical to me as I want the questions to appear sequentially...
06-15-2011 10:31 AM
And the mentioned the problem comes if and when you need to modify the order of the questions. Or if you want to skip certain portions under certain conditions. Sequence structures are very rigid code constructs and should be used very rarely. If you get in the habit of using them regularly it is only a matter of time until their use bytes you in the butt and makes your life difficult.
06-16-2011 12:23 PM
Hi PA_UW,
If you do want more information regarding state machines I would recommend checking out the State Machine Tutorial. Otherwise, one of the VI templates is a Standard State Machine template (Crete New>>VI>>From Template>>Frameworks>>Design Patterns>>Standard State Machine). These templates are design to provide basic program architecture which you can be build off to create a custom VI. To find the VI templates go to File then New in LabVIEW.
I hop that information is helpful!
06-16-2011 12:35 PM
Thanks - I will check those out when I have more time. I appreciate the suggestions. Right now getting the questionnaire up and running is my priority! I have been exploring radio buttons and they may work well actually - super simple really.
06-16-2011 12:39 PM
@PA_UW wrote:
Thanks - I will check those out when I have more time. I appreciate the suggestions. Right now getting the questionnaire up and running is my priority! I have been exploring radio buttons and they may work well actually - super simple really.
Words of wisdom from years of experience. A little thought up front goes a long way to make your life easier down the road. If this application/questionnaire will live for some time take the time and effort to use the right architecture from the beginning. If you take the easy way (sequence structures) now because it seems faster you will most likely find yourself boxed into a corner later on. At that point in time fixing the problem and doing it right will take a lot longer than the time you spend now to start out right. Poor design decisions are VERY costly later on.
06-16-2011 12:51 PM
Thanks - very helpful advice!