Barcode input to excel and read data

Hello,
I am creating a program where I would scan a barcode into LV and from there LV scans an excel spreadsheet for that barcode and returns the data from that row. I found an example online that helps with the barcode number find in excel but I am not coming up with a strange issue when trying to display the information from that row. My program finds the correct barcode in every case. Only when I enter the number from row 1 will the row information be correct. When I enter in information from row 2 lets say it displays the row information from row 3. When I enter in row 3 the program display row 5 information. Attached is my rough copy of code(this is my first stab at Active X controls so bear with it please) and an example spreadsheet I have created with some information about how the program is working. I have checked other posts for similar problems and couldnt find one that hepls with my particular issue. I have also checked the excel specific thread but found no links to code that can help. Any help is appreciated. Im thinking I am over looking something but since this is my first shot at this type of programming im not quite sure what it is. Thanks in advance for any information.
Solved!
Go to Solution.
Attachments:
Programmer(PC02).vi ‏14 KB
Program Numbers.xlsx ‏10 KB

nyc wrote:
The other thread has no VI nor Excel.
I'm curious what is going on in the VI, but I can't open it.
It's the same question, except this time the OP provided a follow-up saying, "OK, here's what I got, and it does this. Why?" I would have just continued in that thread. Whatever.
In any event, your error is that you do not want to wire the found row to the set of Range.Item(get) methods. You need to wire a constant of 1 to the "Row" parameters for both of those. Since you are operating on a found range, you do not want to change the row.
As it stands right now your VI does not close Excel when done. The Excel process remains running in the background. Please review the example that ships with LabVIEW, which closes Excel when done.

Similar Messages

  • Best way to control and read data from multiple instruments?

    Hello,
    I'm building an application to test power supplies involving multiple pieces of equipment over a couple of different comm busses. The application will also send control instructions to some of the instruments, and read data from some of the instruments. The reading and control profiles will not run on the same schedule (variable length control steps, configurable read interval).
    I was thinking of using a queued statemachine (producer/consumer) for the control profile and another to read the data, but I got concerned that there would be collisions between sending control commands and read commands to the same machine. Is there a suggested design pattern for implementing something like this?
    Timing of the commands isn't critical down to the milisecond, but I need to collect reasonably accurate timestamps when the data is read. The same is true for the control commands.
    Here are the instruments I'm going to use, if the are control, read, or both, and the communication method
    Instrument Funtions Comm Method
    Power Supply Read data Communicates to PMBus Adapter
    PMBus to USB Adapter Read data USB (Non-Visa)
    Switch control relays USB (VISA)
    Power Dist. Unit read data/control outlets SNMP (Ethernet)
    Electronic Load read data/control load GPIB (VISA)
    Thermal Chamber read data/control temp Ethernet (VISA)
    Thanks,
    Simon

    Hello, there is a template in LV called "Continuous measurement and Logging".
    It can give you some idea how to properly decouple the "GUI Event handler" top loop (where your Event structure is) from the DAQ and other loops.
    You do not need to totally replicate the above example, but you can find there nice tricks which can help you at certain points.
    The second loop from the top is the "UI message loop". It handles the commands coming from the top loop, and regarding to the local state machine and other possible conditions and states, it can command the other loops below.
    During normal run, the different instrument loops just do the data reading, but if you send a control command from the top loop to a certain instrument loop (use a separate Queue for every instrument loops), that loop will Dequeue the control command, execute it, and goes back to data reading mode (in data reading mode the loop Dequeu itself with a "data read" command automatically). In this way the control and data read modes happen in serial not in parallel which you want to avoid (but I think some instrument drivers can even handle parallel access, it will not happen in really parallel...).
    In every instrument loop when you read a value, attach a TimeStamp to it, and send this timestamp/value couple to the DataLogging loop via a Queue. You can use a cluster including 3 items: Source(instrument)/timestamp/value. All the instrument loops can use the same "Data logging" Queue. In the Datalogging while loop, after Dequeue-ing, you can Unbundle the cluster and save the timestamp and data-value into the required channel (different channel for every instrument) of a TDMS file.
    (Important: NEVER use 2 Event structures in the same top level "main" VI!)

  • How to write and read data in a specific memory location ??

    Hi Everyone:
    Does anyone know how to write and read data in a specific memory location by using Java ?
    I need pointers, but I don't know how to do it ??
    Thanks for answering
    Rodger

    Hi Everyone:
    Does anyone know how to write and read data in a
    specific memory location by using Java ?
    I need pointers, but I don't know how to do it ??
    Thanks for answering
    RodgerWith Java you cannot write to a specific memory location. Java does not have pointers. If you really want to do it, you need to use JNI, i.e write the required functions in C (or other languages that support pointers) and make those functions available to Java (through JNI). This approach is not portable. You can have a look at http://java.sun.com/docs/books/tutorial/native1.1/index.html
    Regards.

  • Having problem with adding and reading dates to/from database !!!

    Hi
    I am new in J2ME
    I am trying to code a simple software.
    My problem is with dates.
    I have a datefield on my menu and the user will choose the date from here. By default, datefield shows todays date. But when I try to write that date to database using rms, date value transforms to java.util.Date@acfdb0fe.
    As I read from tutorials this is common problem of date class, so I tried to use calendar class.
    But with Calendar class I cannot let user to choose date from screen like DateField. datefield dowsn't work with calendar.
    later, I will use that date for sorting records
    Summary : I need a sample code that read date from screen (preferably with datefield), write it to recordstore. and then read it from recordstore asnd write to screen.
    I searching internet for a sample code through days.
    Please help me
    Thanks

    Hi,
    The best i would suggest is instead of storing the date as 19 Jan 2004 or something like this better store the date in milliseconds.
    DateField df = new DateField();
    Date d = df.getDate();
    long ms = d.getTime();
    store the value of ms in RMS. This is the commonly used way to store date in RMS for j2me.
    You can get back date using
    Date d = new Date(ms);
    DateField df = new DateField();
    df.setDate(d);
    Prabhu.

  • Run Excel and read file from excel to display on table

    Is it possible to launch excel and open a new document that shows a default header column for name and phone numbers?
    Is it possible to read this excel file that was created and display onto a table?
    If so, can anyone please show it to me?

    Hi,
    Please could anybody assist with my VI as I am new to Labview and appear to be going around in circles. I am simply trying to search the first column within an excel spredsheet for a specified value and illuminate an indicator if it is found (on front panel).
    I have tried so many threads and previous posts but many seem far to complicated. Any help is appreciated but please understand I am a real novice!!
    I have linked my own efforts for anybody to laugh at. Thanks
    Attachments:
    Help!!.vi ‏17 KB

  • Mssql and reading date

    hi there,
    I am reading data from mssql server and all things are working ok except l can not read date column from the database (l checked date is int type ). However, l used to assign int type variable , it does not work.
    If any one knows please, please help.
    ResultSet result = stm.executeQuery("SELECT a_create_date from ihd_helpdesk") {
    int adate;
    whle(next())
    adate = result.getInteger(a_create_date);

    As DrClap suggests - it is highly likely it is an offset from a specific time in the past. This in not uncommon in the past before nice things like date fields existed. Also this made a date easy to compare and was a very efficent (in terms of storage). If you try taking todays date and subtract the number in seconds from it you will most likely come close to the reference date. Then you should be able to guess the reference date as it will be something very obvious. Get someone to update a record date to today and use it.
    For example.
    Calendar cal = Calendar.getInstance();
    java.util.Date currentDate = cal.getTime();
    // the negative value of the int in the database
    int offSet = -1079618812;
    cal.add(cal.SECOND,offSet);
    java.util.Date test = cal.getTime();
    System.out.println("Reference Date="+test);
    // Reference Date=Thu Jan 01 04:10:37 MST 1970

  • Sending commands and reading data - RS232

    Hello guys !
    I have a special problem communicatin through RS232 with a PIC microcontroller.
    The problem :
    On push of a button i want to read a value from the microcontroller.
    On another push of a button, i want to write a value to the microcontroller.
    However, i get an error : "VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed."
    I've tried to search the forum for similar problem, but i haven't found a suitable answer.
    I also post my current code for reference. I'm using LabView 8.5.1.
    The RS232 communication is working fine (i can read and write from the PIC).
    I tested the connection extensively so i think that te problem is not there.
    Can u help me ?
    Thank you !
    Attachments:
    Serial-1.vi ‏53 KB

    Are you waiting for a response from the device after you send it a command? Are you getting any data back? A simple delay is not a very good solution since your program may work for one given situation but the hard delay may not in others. You can use a VISA event to wait for data at the serial port. How much data are you expecting? If it is a larg eamount of data you may want to calculate the timeout for the read based on the amount of data and your given BAUD rate. If you expect a large amount of data you may not have your timeout set long enough for all the data to arrive, especially if you are using slower BAUD rates.
    I noticed in your code that you have enabled the read to look for a termination character. Does your device send one? If not, you may be getting the error because you have not received the 1000 bytes you indicating you want to receive. If you will not be getting a termination character and you don't know how much data you will be receiving you need to create some type of algorithm to read data and decide when to stop. Th eapproach I use is to read a single byte. This read will contain the maximum timeout to wait for the data to arrive. Once a single byte has been read I continue reading chunks of data using a small timeout value. This value should be long enough to allow any small delay that occurs in the data as it is being sent from the device but short enough to indicate the data is complete once a timeout does occur. This timeout error is discarded since it is not a true communication error.
    NOTE: You should avoid using controls as variables. You have your Byte to Read controls set as default values and hidden. Therefore they are nothing more then a constant. Hiding controls simple to hide "variables" is not a good coding practice. Either expose the controls to teh user or use a constant.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How to acquire and read data before trigger?

    Hi, all:  
             I want to acquire a impluse signal, and the data when the signal begins is very important to me. So, I want to using a digStart trigger to acquire it, but then i'll lose what i want, maybe i can acquire it continuously, and use the trigger to start read the buffer after a delay(in order to wait the signal end), i don't know if there is any ANSI C functions I can use to do it in this way. I am using PCI6220, DAQmx9.02 and ANSI C.   If anyone have some info on this please let me know. thinks.

    Hi Cris Brown:
                   From your application,I suggest that you can use DAQmxCfgDigEdgeRefTrig function; define  pretrigger samples fitting for your application.
    Try it. Best Regard!

  • Uploading Excel File and Reading Data from that File

    <b>Hi
    Can anyone Please tell me how to upload an Excel File in to the Web Dynpro Application and After that i want to read the data from that uploaded excel file in the Web Dynpro Application to the Web Dynpro table.
    Plz help me to solve this.......
    Regards
    Chandran</b>

    Hi,
    Upload Excel file using File Upload UI
    1)Add jxl jar folder in the lib folder of ur project.
    2)Go to properties of ur project and add jar to ur project.
    3)Using the File upload ui ,browse and upload the file.
    4)Write the read file in to ur server location using fileoutput stream.
    5)then using code u can read the excelfile from the server location itself.
    Here is the code:
         IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
    /** get the name of excel file and storing it in the server with the same name and extention****/
    binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
    fileuploaded = binaryType.getFileName();
    byte b[] = wdContext.currentContextElement().getUpload();
    File filename =new File("
    <Server name>
    <folde name>
    " + fileuploaded);
    try {
    FileOutputStream out = new FileOutputStream(filename);
    out.write(b);
    out.close();
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    /**Readind from the server**/
    int iRows = 0;
    try {     Workbook wb = null;
         Sheet sheet = null;
         wb = Workbook.getWorkbook(filename);
         sheet = wb.getSheet(0);
         int iColumns = sheet.getColumns();
          iRows = sheet.getRows();
         int i = 0;
        //get Cell contents by (COLUMN, ROW);
        for (int r = 0; r < iRows; r++) {
       for (int c = 0; c < iColumns; c++) {
         Cell cell = sheet.getCell(c, r);
         characterarray<i> = cell.getContents();
    //wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);
    i++;
    wb.close();
    Declare Globally
    //@@begin others
    String fileuploaded;
    IWDModifiableBinaryType binaryType;
    String characterarray[] = new String[1000];
    //@@end
    Also look at this blog too  /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
    Thanks and Regards,
    Arun

  • Writing and reading data from a form

    I am trying to write a save and load feature for an application using mostly Jtextboxes and things. Basically I have a form that the user enters data into. I want to be able to save this data and load this data. I am relatively new to working on a GUI and I'm not quite sure if my knowledge of I/O applies to this. This is my stab at it but if I am completely off I would not be surprised. I don't want to print it to the command line but this was all I could think of right now. Any help would be greatly appreciated.     
    private void SavePrefs() {
              File SavePrefs;
              // get filename:
              fc.setDialogTitle("Select Filename For Site Data");
              int result = fc.showOpenDialog(f);
              if (result == JOptionPane.OK_OPTION) {
                   SavePrefs = fc.getSelectedFile();
                   // default file extension ".CMM"
                   if (!SavePrefs.getName().endsWith(".CMM")) {
                        // filename does not meet requirmeents:
                        System.out.println("NO CMIMS in filename");
                        SavePrefs = new File(SavePrefs.getAbsolutePath() + ".CMM");
                   // continue with save code:
                   System.out.println("File Selected:" + SavePrefs.toString());
                   //Creates a .cmm file with a code in it containing the data from the first site tab.
                   FileOutputStream out; // declare a file output object
    PrintStream p; // declare a print stream object
                   try
    // Create a new file output stream
    out = new FileOutputStream(SavePrefs.toString());
    // Connect print stream to the output stream
    p = new PrintStream( out );
    p.print(_SitePropPanel);
    p.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
                   JOptionPane.showMessageDialog(null,
                             "File is saved.");
              // not OK selected (cancel or.?)
         private void LoadPrefs() {
              File loadPrefs;
              // get filename:
              fc.setDialogTitle("Select Filename For Site Data");
              int result = fc.showOpenDialog(f);
              if (result == JOptionPane.OK_OPTION) {
                   loadPrefs = fc.getSelectedFile();
                   // default file extension ".CMM"
                   if (!loadPrefs.getName().endsWith(".CMM")) {
                        // filename does not meet requirements:
                        System.out.println("NO CMIMS in filename");
                   // continue with save code:
                   System.out.println("File Selected:" + loadPrefs.toString());
                   try
         // Open the file that is the first
         // command line parameter
         FileInputStream fstream = new
                                  FileInputStream(loadPrefs.toString());
         // Convert our input stream to a
         // DataInputStream
                             DataInputStream in =
         new DataInputStream(fstream);
         // Continue to read lines while
         // there are still some left to read
         while (in.available() !=0)
         // Print file line to screen
                                  System.out.println (in.readLine());
                             in.close();
         catch (Exception e)
                             System.err.println("File input error");
              JOptionPane.showMessageDialog(null, "Feature is not yet implemented.");
         }

    Oh and the GUI is a window with menus where the save feature resides, but the data is in tabbed panels. That is where the _SitePropPanel comes in. I know I want it to write the input from the panel and not the panel. What would would I use for that? I tried getInputContext().                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to open and read data from text file in PL/SQL

    We have a project ,need to open a file containing entries of data
    ,then process those data records one by one to update the
    database.This operation shoulbe be done in the database
    enviroment. Is there any hint about the file operation in
    PL/SQL? How to open the file and get one record ,maybe one line,
    and parse and get the data field ?
    thanks
    defang

    There was also a question on this over at AskTom
    (asktom.oracle.com) about a week ago complete with sample code.
    The pointer to the sample code is here:
    <A HREF="http://asktom.oracle.com/pls/ask/f?
    p=4950:8:::::F4950_P8_DISPLAYID:464420312302
    TARGET=_blank>http://asktom.oracle.com/pls/ask/f?
    p=4950:8:::::F4950_P8_DISPLAYID:464420312302</A>
    Admittedly it's about Win95, but the principles should apply.
    Yours faithfully, Graham Reeds.
    [email protected] | http://omnieng.co.uk/

  • How to make VI wait until data is saved before it can open and read data

    I have developed two VIs for continuous monitoring. First VI is for acquiring raw strain data and saving it into a folder, let's say, every 10 minutes or every 100 Mbyte of data (for example, after monitoring for an hour, the folder will have 6 files, each of which contains 10 minutes of data). Second VI is for opening/reading/processing data files collected by the first VI.   Right now, this second VI can handle only one file at a time. What I am trying to do is to have this second VI open the files one after another automatically. Also (here is what I think will be difficult part), I want the second VI recognize that a file is saved by the first VI before opening it (i.e., wait until the first 10 minutes of data file is saved by first VI, open and process this first data, wait until the second 10 minutes of data file is saved by first VI, open this second file and process it, wait until the third 10 minutes of data file is saved by first VI, open and process it........). Any help or comments would be appreciated.
    Thanks in advance for your help.
    Brdg.

    Basically, If your purpose is to keep one thread from opening the file until the DAQ thread has finished with it, then the queue is what I would use.
    All functions are on the ADVANCED | SYNCHRONIZATION | QUEUE palette.
    Use the OBTAIN QUEUE to create the queue. Set the DATA TYPE to a PATH constant. This creates a queue of paths.
    Pass the QUEUE REFNUM to both the DAQ VI, and the PROCESSING vi.
    In the DAQ VI, when you write a file, take the PATH from the CLOSE FILE function and use ENQUEUE ELEMENT to put it into the queue (use the refnum you passed in).
    In the processing thread, use DEQUEUE ELEMENT to fetch the path from the queue. You probably should use a timeout value of 1000 mSec or so. If you timed out, go check your PROGRAM RUNNING flag (so you can stop without waiting forever on the queue), and if you're not stopped, try again.
    If the DEQUEUE ELEMENT returns WITHOUT a timeout, then open the path it gives you - the file is guaranteed to be closed, since you closed it before you enqueued it.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Using forms6i and reading data from MS SQL server 7

    Hi!
    I have been given a new task to connect to Microsoft SQL SERVER 7 with Oracle 6/6i development with ODBC and extract specific data.
    I am realy stuck with this I hope some one will help me with this as soon as possible.
    thanka

    I did a similar thing with developer 2000 (Form 4.5) and SQL server6.5.
    There are lots of things involved and there will be issues that need to be resolved in you application but you can take one thing at a time and you should be able to do it.
    -First make sure that your SQL server is up and running.
    -Then make a client machine that connects to SQL server.
    -On the client install your Form6 or 6i.
    -Install ODBC manager on your Client Machine.
    -Get the Oracle ODBC driver for SQL server.
    -There is a document available with developer 2000 for open data source. It should be with your Form6/6i documentation. It has got a section for connection with SQL server.
    Start with this and where ever you get stuck ask away question on the forum.
    Hope this help

  • Best way to browse and read data from a lot of files?

    Hi All,
    I am trying to read tags from music files. Currently I'm listing all the files and then reading through the tags, as below:
    List<File> result = new ArrayList<File>();
    FilenameFilter mp3filter = new FilenameFilter() {
         public boolean accept(File dir, String name) {
              return name.endsWith(".mp3");
    FilenameFilter wmafilter = new FilenameFilter() {
         public boolean accept(File dir, String name) {
              return name.endsWith(".wma");
    FileFilter dirFilter = new FileFilter() {
         public boolean accept(File file) {
              return file.isDirectory();
    File[] dirList = aStartingDir.listFiles(dirFilter);
    File[] mp3files = aStartingDir.listFiles(mp3filter);
    File[] wmafiles = aStartingDir.listFiles(wmafilter);
    List<File> filesDirs = Arrays.asList(dirList);
    List<File> filesMp3 = Arrays.asList(mp3files);
    List<File> filesWma = Arrays.asList(wmafiles);
    for (File file : filesMp3) {
         result.add(file);
    for (File file : filesWma) {
         result.add(file);
    for (File file : filesDirs) {
         List<File> deeperList = getFileListing(file);
         result.addAll(deeperList);
    }and then read the files in a for loop through the list.
    Is there a better way to do the same?

    Well, you could optimize that just a little bit by only calling listFiles once with a filter that would accept directories, wmas, and mp3s all in one go. Then you could iterate through the results and separate them into the three categories after you had the complete recursive directory listing. That may be faster. But your OS will likely cache the results of the directory listing, thus minimizing the effort of your current approach. But honestly, no... you need the headers from every file, so you'll need to find each file and then check the headers.
    If you want, you can cache the results somewhere for future reference. Are you concerned about performance or some such?

  • Mac pro 13'' harddisk makes noises when writing and reading data, but Techtool scanning result shows no bad blocks in the disk, that is normal?

    I bought my Mac pro 13 inch, i7 processor and 750G storage 20th November 2012. But I found when copy into or out the Mac, the harddisk makes noises, like bitting something. I thought there are bad blocks in the disk, but the result of Techtool scanning is no bad blocks in disk, and giving a passed conclusion.
    I went the apple store for testing, and the repairmen told me there are two choices available for me:1) replace the harddisk 2) back to the store i bought machine from for a new one. i think that the machine only bought few days, it had better not be disassembled, so i went back for a new one. unfortunately, the new one makes more noises than my old one. i don't know why like apple named brands notebooks have such problems.  did you undergo this experience ?

    All of the HDDs, be they in my MBPs or enclosures are barely audible.  I would say the you deserve no less.  I suggest that you do not leave until you are satisfied with a near silent HDD.
    Why you got two in a row is a puzzle, but then some people beat the odds and win the lottery.  In your case the results are not exactly positive.  All HDDs eventually fail, and some fail sooner than others.  At least you should start with a quiet one.
    Good luck.
    Ciao.

Maybe you are looking for

  • Vendor line item display -effective exchange rate showing inverse

    Dear All, We are using direct quote. In vendor line item display FBL1N . effective exchange rate field showing inverse for all currencies except USD. Issue: Rates are maintained in Direct quote then why in FBL1N its showing Indirect quote, but in hea

  • My imac when playing Itunes and editing in lightroom

    Hello all, this happened and couple days ago. I was listing to itunes and editing in light room 2 my macs screen just went black and the music was still playing just skipping Its done it 4 times now. Its kinda crucial i figure this out. its out of wa

  • [PKGBUILD] icon-theme.cache is already present

    Hi, I created a PKGBUILD to test « perroquet » (http://perroquet.b219.org/index.html), it's also the mean to do my first PKGBUILD ;-) so any comments are welcome. The PKGBUILD is here : http://pastebin.com/m943685e Unfortunately, when I want to insta

  • Can't Change a Filename in Bridge?

    I thought Bridge was a photo management utility. I can't even change a photo filename. Is there a way to do it, or what kind of photo management utility is this?

  • Opening Macromedia flash 8 fla file in the adobe flash cs4

    Hi....!      I am new in this filed....,      I try to open the macromedia flash 8 version flash file in the Adobe Flash CS4. At that time one "Font Mapping" window came. In that Window  "The document "Name" contains one or more fonts currently not a