LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for a specific string from an excel sheet

I'm getting a bit confused here amt1981,

 

Are you just still replying to Jim's post, or have you just failed to notice that three people have responded in this thread since it started:

Jim

James

Ray

 

Who are you talking to when you write "Dear Jim", do you mean Jim, or are you actually talking to anyone who will help under the "Agony Aunt" sytle letter format "Dear Jim, ..." ?

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
Message 11 of 40
(2,443 Views)
You are not the only one who is confused...  😮
0 Kudos
Message 12 of 40
(2,430 Views)

Hehehe i am really sorry guys, it is me who didn't notice that there was 3 of you, and that's because i was so tired and its been like 2 days i am working on this project without sleeping but 3 hours a day because the project's due date is on the 30th of April and i still didn't have this matter solved.

So i really thank all of you for your assistance and sorry for my confusion.

 

By the way Ray i tried your solution, well the problem is that it is always returning -1 as an index and the for loop is running continuously so maybe i am doing something wrong in here.

So i've meant to ask you the read spreadsheet file.vi should return an array containing all the contents of the excel or tab delimited file right? And then in the for loop we are making the program search for a 1D array for the index at which the string or the whole row is found right? So i just want you to explain to me what happens when we wire the output of the read spreadsheet file.vi to the search 1D array input, and then what should i expect from the output i get.

 

Thanks again guys for your assistance and i really appologize for thinking that you are all one person

 

Best Regards

 

Amin

0 Kudos
Message 13 of 40
(2,398 Views)

Can you post your spreadsheet?  That way we can see better what is going on.

 

Typically, you read the spreadsheet file as a 2D array.  It indexed automatically each row, so you get all the data per line, and they are nicely put inside a 1D array, based on the delimiter (comma, space, tab, etc).  You then search for the string using the Search 1 D array which returns you the index of the row where it was found.  In the example I provided, it does 2 separate ways of getting the data, one is to provide the index and you can again select the row from the 2D array, or, since it found a match, why not provide the row right away (bottom for loop).

 

By looking at your spreasheet, I can recommend how to "tweek" the example that I posted.

0 Kudos
Message 14 of 40
(2,384 Views)

I am enclosing my tab delimited file because it keeps on giving me -1 as an index and an empty arrar for the second for loop. so maybe you can find where i've done wrong in my file or somewhere else.

0 Kudos
Message 15 of 40
(2,365 Views)

Are your files actually saved as .docx? If they are that is a Microsoft proprietary format and the read from spreadsheet.vi can not understand it. When you actually collect your data how are you saving it? So far you've mentioned tab deliminated and excel (another proprietary format) but yet you post a .docx.

 If they are .docx you could open one and save it as a .txt and then try his code.

Now Using LabVIEW 2019SP1 and TestStand 2019
Message 16 of 40
(2,357 Views)

Well Said GovBob.

 

I am not allowed to open .docx (or other Word/MS) documents at this establishment due to strict rules to protect against viruses.

You should save it as some other format, and avoid using word or excel or anything that microstuff creates.

 

 

Message 17 of 40
(2,340 Views)
You are right guys, i sent the wrong version, because it has the same name with 2 different formats!! This is the .txt version!!
0 Kudos
Message 18 of 40
(2,326 Views)

Did you run the delimiter.txt with the example I provided?

 

This is what I get when I enter the last license plate number:

 

 

Message Edited by Ray.R on 04-28-2010 12:28 PM
0 Kudos
Message 19 of 40
(2,310 Views)

OOps!  My bad.  Just noticed the index.

Brain cells were not cooperating..   😉

 

Here is the new snippet and output.

 

 

 

 

Message Edited by Ray.R on 04-28-2010 12:32 PM
Download All
0 Kudos
Message 20 of 40
(2,307 Views)