LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

only post to DB when true

Solved!
Go to solution

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)????

 

 

0 Kudos
Message 1 of 10
(3,115 Views)

Hi Zaico,

 

              post your VI.Then anyone can help you.

            

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
Message 2 of 10
(3,104 Views)

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.

Message 3 of 10
(3,101 Views)

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

0 Kudos
Message 4 of 10
(3,096 Views)

Is there really no one that can help me??Smiley Sad

 

please.... Smiley Happy

0 Kudos
Message 5 of 10
(3,070 Views)

Put what you want to do inside the True case. Leave the False case empty.

 

 

0 Kudos
Message 6 of 10
(3,067 Views)
Solution
Accepted by topic author Zaico

@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.

0 Kudos
Message 7 of 10
(3,065 Views)

Now I see what you ment... I'll trie that right away...

0 Kudos
Message 8 of 10
(3,060 Views)

Okay, I can't seem to get to work the right way....

 

I'm gonna take a look at the tutorials as you sugest....

0 Kudos
Message 9 of 10
(3,056 Views)

It works perfectly... you saved my day..

 

reading more into case structures then the info given in LabView opend my eys...Smiley Happy

 

i had given the case selector an constant and not wireing it to the output of the button Smiley Embarassed... now it works as i want it to... Smiley LOL

0 Kudos
Message 10 of 10
(3,052 Views)