04-27-2012 06:06 AM
Hi
i will need some time to put the code into a format that will work. There are a lot references to other areas.
I've included a screen shot of the section i think is an issue.
I've also included data so you can see whats happening.
Database121 before is captured data. As i do tests it adds the serial numbers and data to the end of the file.
Database121 after is what is actually happening.
Database121 what i want has had line 54321/4 deleted from original file (as it has failures) and appened to end of file as a retested pass.
Not they are xls files as they have been opened and saved. Normally within the software execution they remain lvm files.
Thanks for all of your help.
04-27-2012 06:26 AM
Try the code in the attached picture and let me know if that is what you are looking for.
04-27-2012 06:34 AM
That not quite what i'm trying to do.
I've included 3 screen dumps. 1 left, 2 middle, 3 right.
I want to search for a serial number, if found delete from file, then save back to file.
If the serial number is not found there is no need to delete it so just save the data at the end.
Thanks for your help, much appreciated.
04-27-2012 06:52 AM
What is it that you are writing to the file with the position set to 'end'?
I would actually need the code to test before I can make suggestions.
04-27-2012 07:13 AM
Hi
i can strip out the code but its gonig to take some time.
It all seems to work fine except when i want to replace the data set with the new data set. The data set to delete occurs but the rest of the data is duplicated before the new data set is added.
Strange.
04-27-2012 07:20 AM
Did you try with 'replace or create'? Also, you are writing another set of info at the end. what is that?
04-27-2012 07:30 AM
Hi
yes i did try it as you sugested. It completely wiped the file except for the new data set. I assume with the replace aspect of the function.
Ill try to explain in more detail.
There are two routes.
Testing an item i have not tested before
1. Input serial number to front panel.
2. Test item.
3. Click save.
4. VI checks to see if item has been tested before.
5. No, therefore saves data to bottom of file amending my database with a growing amount of data.
This seems to work with out a glitch.
Testing an item i have tested before
1. Load up the failed set of test data to front panel array.
2. Retest item.
3. Click save.
4 Vi checks to see if item has been tested before.
5. Yes, therefore deletes rows of any data corresponding to the old data.
6. Saves the new data to the bottom of the file ammending my database with a growing amount of data.
This doesn't seem to work. It deletes the original rows of data, duplicates all of the other existing rows again at the bottom and then adds the new data to the very bottom, giving me duplicates of the original data i want to leave.
04-28-2012 07:56 AM
Hi.
I think it would be best if I waited till you could give me a part of your code so that I can test and see what your problem is. It will of not much use if I kept on suggesting you to do things without actually seeing to myself what the problem could be. With the code, I could debug it and make some trials before giving you a suggestion.
04-28-2012 08:48 AM
Hi
I need one more clarification.
1. You are reading the file using 'Read Spreadsheet'. then opening it again as a text file, reading the data, deleting some data, writing back to the file. Then, you open it again and append some new data to it. Why are you opening and closing the file so many times? You can open it once and write to it once, after you finish your modifications.
2. What is the size of the array of strings you get from the For Loop in the second image?
Would again suggest you to post a code that i can test on.
04-30-2012 02:46 AM
Hi
thanks for the support. It is appreciated. Yes i do open and close the file a few times. This is because i have two cases. A item that has not been tested and an item that has.
Please find attached a seciton of code.
You may want to remove the iteration section as the array is not the correct size and shows an error. I wanted to post the code though, rather than edit it all.
I believe that to be the only error.
Thanks again.