05-18-2012 05:43 AM
Hello
I have made VI that post to an MySQL DB when the Lego NXT touch button on port 1 is pressed, but as it is now, it post both True and False statements and I only need the True statements.
I can't seem to find a VI that only outputs True and sends it to the DB connection and just throw False away.
Can this be done in some way, (it must be possible)????
Solved! Go to Solution.
05-18-2012 07:15 AM
Hi Zaico,
post your VI.Then anyone can help you.
05-18-2012 07:20 AM
Perhaps I'm misundersating what you are trying to do, and perhaps you have little to no programming experience, but it sounds to me like you're looking for a case structure?
To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. There are also several Technical Resources. You can also take the online courses for free.
05-18-2012 07:41 AM
heres my VI
But with a case structure, I have to set both true and false output, I can't just get it to discard false and only use true... but perhaps it's just me??
Can you take a look at my VI and see if it's just me??
thank you
05-19-2012 11:23 AM
Is there really no one that can help me??
please....
05-19-2012 11:26 AM - edited 05-19-2012 11:27 AM
Put what you want to do inside the True case. Leave the False case empty.
05-19-2012 11:30 AM - edited 05-19-2012 11:33 AM
@Zaico wrote:
heres my VI
But with a case structure, I have to set both true and false output, I can't just get it to discard false and only use true... but perhaps it's just me??
Can you take a look at my VI and see if it's just me??
thank you
You didn't use a case structure in your VI. You used a select statement.
Please take the tutorials. A case structure is such a basic and important concept in LabVIEW that if you aren't familiar with it, then you are a long ways away from being able to do even basic LabVIEW programming.
You would put the DB Tools Insert Data subVI into the true case. You would put nothing into the false case except wiring the connection reference and error wires through.
You don't want to put the the open connection and close connection inside the while loop. Put the open before, and the close error. It is a waste of resources to continually open and close the same connection on every iteration of the while loop.
You probably also need a wait timer inside the while loop. Unless there is something in the subVI's that control the execution speed of the while loop, you will be running this loop at such superfast speeds and it will consume 100% of the CPU time. This will hurt the operation of your VI and perhaps the operation of your entire PC.
05-19-2012 11:34 AM
Now I see what you ment... I'll trie that right away...
05-19-2012 11:46 AM - edited 05-19-2012 11:47 AM
Okay, I can't seem to get to work the right way....
I'm gonna take a look at the tutorials as you sugest....
05-19-2012 11:54 AM
It works perfectly... you saved my day..
reading more into case structures then the info given in LabView opend my eys...
i had given the case selector an constant and not wireing it to the output of the button ... now it works as i want it to...