04-27-2010 02:39 AM
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
04-27-2010 07:06 AM
04-27-2010 11:44 AM
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
04-27-2010 03:50 PM
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.
04-27-2010 06:22 PM
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.
04-27-2010 06:53 PM
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.
04-28-2010 07:00 AM
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.
04-28-2010 09:28 AM
04-28-2010 11:28 AM - edited 04-28-2010 11:28 AM
Did you run the delimiter.txt with the example I provided?
This is what I get when I enter the last license plate number:
04-28-2010 11:31 AM - edited 04-28-2010 11:32 AM
OOps! My bad. Just noticed the index.
Brain cells were not cooperating.. 😉
Here is the new snippet and output.