LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check a database

Solved!
Go to solution

Hello

I want to do a program in Labview where I introduce a code number and I want to check in a database if my code number appear´s in that database.

I have to do something like this?

0 Kudos
Message 1 of 7
(2,590 Views)

OK, you've got the Example to show you how to get all of the data out of the database.  It looks like it is returning the data as a 2D Array of strings.  Do you know how to search an Array for an entry ("code number")?  If not, spend some time with the LabVIEW Tutorials, especially Arrays and Array Functions, and also perhaps on Strings.

 

Bob Schor

0 Kudos
Message 2 of 7
(2,552 Views)

Yes, I have done a program where I introduce a code number and when I press "enter" the program checks if the length of the code number and the length that I have specified is the same. If the length is the same one LED indicates that the length of the code is okey. Now, after checking the length of the code I want to check in a database if the code that I have introduced appears in the database.

I have done this program but I don´t know how to continue.

Might you help me, please

 

0 Kudos
Message 3 of 7
(2,545 Views)

This is the program

0 Kudos
Message 4 of 7
(2,543 Views)
Solution
Accepted by topic author labview99

Here are some comments on (and a minor clean-up of) your code:

  • No Frame Sequences are needed -- the Rules of Data Flow will work for you without them.
  • In most LabVIEW routines, having the Error Line running through the major loops (and in a straight line!) usually is a good idea, if for no other reason that it tends to make the code "neater" (that's not a bad reason, but a better one is that it forces sequential execution when you need it).
  • Your "Fin OK" State opens the Data Base, does some unknown Data Base routines (starting with opening the DB, getting a list of Tables and not yet doing anything with it, and doing something with Column Lists, presumably eventually extracting data and formatting it into a string, which you haven't yet used), and then closes the Data Base.  I suspect this can, and probably should, be broken into several sub-States:
    • Open the DB, saving the Connection Reference in a Shift Register.
    • Get the List of Tables.
    • Do whatever you need to do with the Tables.  You might want to do this in a single State, or possibly have a State that does one Table, and call it again if there are more Tables left to do.
    • When you are done, go to a State to close the DB.
  • Note that you might not want to open and close the DB for every input.  [Sorry, my Spanish isn't as good as my son's, so I haven't tried to understand what you are doing in the other States].  You might decide that you can open the DB, ask a Question, use the DB to answer it, ask another question, get DB to answer, repeating until either an Error or an "instruction" to stop, when you then close the DB and exit.

I've saved my revised version of your VI for LabVIEW 2014.  The changes are all "cosmetic" (except for getting rid of the Frame Sequences).

 

Bob Schor

Message 5 of 7
(2,512 Views)

Thank you so much for all your explanations! You have been very heplful!

0 Kudos
Message 6 of 7
(2,487 Views)

I´m going to correct my program

0 Kudos
Message 7 of 7
(2,486 Views)