C CD Tom Member Licensed User Longtime User Jan 11, 2013 #1 I don't know why I'm getting this error because it was working before and I only added some columns to the csv file. Here's what I did. In my access database I've created a query that extracts data to a .csv file the original query worked just fine I would email the file to my android device and save it in the download directory. My program would copy that file to the DirDefaultExternal with this code. Code: If File.Exists(File.DirRootExternal,"download/MBRS.csv") = True Then File.Copy(File.DirRootExternal,"download/MBRS.csv",File.DirDefaultExternal, "MBRS.csv") End If The program would then run this code Code: table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") This was working fine until I add some columns to the query that extracts to the .csv file now when the above line is executed I get the error "table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") java.lang.StringIndexOUtOfBoundsException: Length=48 index=1" I tried to attach the .csv file but I get an invalid file when I try and upload it. What do you need to help me find out what I did to get his error. Last edited: Jan 11, 2013
I don't know why I'm getting this error because it was working before and I only added some columns to the csv file. Here's what I did. In my access database I've created a query that extracts data to a .csv file the original query worked just fine I would email the file to my android device and save it in the download directory. My program would copy that file to the DirDefaultExternal with this code. Code: If File.Exists(File.DirRootExternal,"download/MBRS.csv") = True Then File.Copy(File.DirRootExternal,"download/MBRS.csv",File.DirDefaultExternal, "MBRS.csv") End If The program would then run this code Code: table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") This was working fine until I add some columns to the query that extracts to the .csv file now when the above line is executed I get the error "table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") java.lang.StringIndexOUtOfBoundsException: Length=48 index=1" I tried to attach the .csv file but I get an invalid file when I try and upload it. What do you need to help me find out what I did to get his error.
Erel B4X founder Staff member Licensed User Longtime User Jan 11, 2013 #2 Please zip the CSV file and upload it. Upvote 0
C CD Tom Member Licensed User Longtime User Jan 11, 2013 #3 Ok here it is. Last edited by a moderator: Jan 13, 2013 Upvote 0
C CD Tom Member Licensed User Longtime User Jan 12, 2013 #4 I'm so at a loss I have no idea what to look for. I've even gone back to the original MBRS.csv file and get the same error. Can anyone tell me what causes the error StringIndexOutofBoundsException Length: 48 Index -1 if I had some idea what I could have done then maybe I can fix this. I've add the complete program in case you need it. Attachments mbrsapp.zip mbrsapp.zip 26.3 KB · Views: 294 Last edited: Jan 12, 2013 Upvote 0
I'm so at a loss I have no idea what to look for. I've even gone back to the original MBRS.csv file and get the same error. Can anyone tell me what causes the error StringIndexOutofBoundsException Length: 48 Index -1 if I had some idea what I could have done then maybe I can fix this. I've add the complete program in case you need it.
klaus Expert Licensed User Longtime User Jan 12, 2013 #5 Tow points, I don't know if it will solve your problem. 1) Are you sure that in Table1.SetHeader you have all columns ? 2) In the csv file all data are within double quotes in one of your older files all data are without double quotes. Best regards. Upvote 0
Tow points, I don't know if it will solve your problem. 1) Are you sure that in Table1.SetHeader you have all columns ? 2) In the csv file all data are within double quotes in one of your older files all data are without double quotes. Best regards.
C CD Tom Member Licensed User Longtime User Jan 12, 2013 #6 When you say table1.setheader I don't have anything like that in my code. What is that and how do I put it in my code? Upvote 0
When you say table1.setheader I don't have anything like that in my code. What is that and how do I put it in my code?
M Mahares Expert Licensed User Longtime User Jan 12, 2013 #7 You need to make sure that the file MBRS.csv is located in the download folder of the device. I copied it to that folder and your program worked fine after that. I as able to search members. That is the only thing wrong I noticed. Upvote 0
You need to make sure that the file MBRS.csv is located in the download folder of the device. I copied it to that folder and your program worked fine after that. I as able to search members. That is the only thing wrong I noticed.
C CD Tom Member Licensed User Longtime User Jan 12, 2013 #8 I did the same thing, I copied the MBRS.csv to the download folder then changed the table = su.loadCSV(File.DirRootExternal, "download/MBRS.csv", ",") and ran it but I get the same error. Upvote 0
I did the same thing, I copied the MBRS.csv to the download folder then changed the table = su.loadCSV(File.DirRootExternal, "download/MBRS.csv", ",") and ran it but I get the same error.
M Mahares Expert Licensed User Longtime User Jan 12, 2013 #9 You should not have changed that line. Keep like it was in the zip file you posted. It should be like this: Code: table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") It should be like this for it to work because you are copying the csv file from DirRootExternal to DirDefaultExternal in your code Upvote 0
You should not have changed that line. Keep like it was in the zip file you posted. It should be like this: Code: table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") It should be like this for it to work because you are copying the csv file from DirRootExternal to DirDefaultExternal in your code
C CD Tom Member Licensed User Longtime User Jan 12, 2013 #10 I still get the error stringindexoutofboundsexternal I'm about ready to quit I just don't understand why you are getting it to work and mine will not work. Upvote 0
I still get the error stringindexoutofboundsexternal I'm about ready to quit I just don't understand why you are getting it to work and mine will not work.
M Mahares Expert Licensed User Longtime User Jan 12, 2013 #11 Tom: Here is what I did, nothing magic: 1. I unzipped and installed your app. I did not make any modifications to your programs. 2. I copied the csv file you posted a day or so ago to the download folder of the DirRootExternal. In my case DirRootExternal is not in the SD card proper. It is part of the internal memory, but referred to as DirRootExternal. 3. I ran the app. It went through the indexing and so forth, then I clicked on search button on your form. I started typing names and it workedThat is all. Let us hope that Professor Klaus can pull is magic. Upvote 0
Tom: Here is what I did, nothing magic: 1. I unzipped and installed your app. I did not make any modifications to your programs. 2. I copied the csv file you posted a day or so ago to the download folder of the DirRootExternal. In my case DirRootExternal is not in the SD card proper. It is part of the internal memory, but referred to as DirRootExternal. 3. I ran the app. It went through the indexing and so forth, then I clicked on search button on your form. I started typing names and it workedThat is all. Let us hope that Professor Klaus can pull is magic.
C CD Tom Member Licensed User Longtime User Jan 13, 2013 #12 Well, I'm back at it again today. I did the same thing as you took the zip I had attached created a new program and tried it guess what I get the same error. I'm wondering if I should reinstall the B4android program. This just doesn't make any sense. Anybody got other suggestions. Upvote 0
Well, I'm back at it again today. I did the same thing as you took the zip I had attached created a new program and tried it guess what I get the same error. I'm wondering if I should reinstall the B4android program. This just doesn't make any sense. Anybody got other suggestions.
Erel B4X founder Staff member Licensed User Longtime User Jan 13, 2013 #13 Why don't you add the file to the Files tab and then load it from File.DirAssets? Upvote 0
mc73 Well-Known Member Licensed User Longtime User Jan 13, 2013 #14 Sure you don't have a 'corrupted' or badly edited csv file at your device? I would suggest copying a fresh copy of your file either from assets or manually. Upvote 0
Sure you don't have a 'corrupted' or badly edited csv file at your device? I would suggest copying a fresh copy of your file either from assets or manually.
C CD Tom Member Licensed User Longtime User Jan 13, 2013 #15 I reinstalled the program but that didn't work either. What version of B4Android are you using? Upvote 0
mc73 Well-Known Member Licensed User Longtime User Jan 13, 2013 #16 Reinstalling the program doesn't necessarily mean that the file is reinstalled. Upvote 0
C CD Tom Member Licensed User Longtime User Jan 13, 2013 #17 Ok, what I did was start a new project, downloaded the zip file of my program and unzipped it into a new directory on my computer. I then selected open source under file and selected the new directory and select the program. I just don't know why I get that stringindexoutofboundsexception length = 48 index = -1 what does the index -1 mean? It almost sounds like there is nothing in the file. I have uninstalled the program from my nexus and have run the compiler and installed the program again on the nexus. Last edited: Jan 13, 2013 Upvote 0
Ok, what I did was start a new project, downloaded the zip file of my program and unzipped it into a new directory on my computer. I then selected open source under file and selected the new directory and select the program. I just don't know why I get that stringindexoutofboundsexception length = 48 index = -1 what does the index -1 mean? It almost sounds like there is nothing in the file. I have uninstalled the program from my nexus and have run the compiler and installed the program again on the nexus.
C CD Tom Member Licensed User Longtime User Jan 13, 2013 #18 Ok, this time I started a complete new project and reentered everything, and as soon as I hit this line of code Code: Dim su as StringUtils Dim table as list table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") I get the stringindexoutofboundsexception length 48 index -1 I don't know where to go or what to do. What else can I try??? In looking at the libs I see my version of StringUtils is 1.02 don't know if that makes any difference Last edited: Jan 13, 2013 Upvote 0
Ok, this time I started a complete new project and reentered everything, and as soon as I hit this line of code Code: Dim su as StringUtils Dim table as list table = su.LoadCSV(File.DirDefaultExternal, "MBRS.csv", ",") I get the stringindexoutofboundsexception length 48 index -1 I don't know where to go or what to do. What else can I try??? In looking at the libs I see my version of StringUtils is 1.02 don't know if that makes any difference
C CD Tom Member Licensed User Longtime User Jan 13, 2013 #19 Mahares, If you still have my program working can you zip it up and let me try it. I don't know if it will make any difference but don't know what else to do. Upvote 0
Mahares, If you still have my program working can you zip it up and let me try it. I don't know if it will make any difference but don't know what else to do.
M Mahares Expert Licensed User Longtime User Jan 13, 2013 #20 I think you best bet is to again zip you full project and export as zip and include the csv file as you have it, so forum users have a chance to test it on their devices. You probably also need to indicate exactly where you are storing the CSV file initially. Although I did not get an error when I ran it a few days ago even with the new fields, here are a few things to consider down the road when dealing with text files: 1. Avoid comma separated files when you have already commas in the field data. I saw that you have commas in some of the last names. The best way to use a text file when there are comma in the data is to use a TAB delimited text file or semi colon separated file. 2. Most data in that new text file have double quotes as a qualifier. You did not have that in your original text file that had fewer fields. I do not know if that can cause problems. ADDED: Here is zipped you program. It is exactly the way you posted it. I did not change any code except the package name. It ran for me. Here is what I did: 1. I Installed it on a Nexus 7 2. I copied the csv file you posted (the new one with the added fields) from my PC to the Download folder of the Nexus. 3. Ran the program. No error. Then I clicked on the Search Button. I was able to search. That is the extent of the testing I did. I did not do any other testing. I only tested to see if I get the same error you did. If you need your csv file, I can zipped for you also, but I assume you still have it. Attachments CDtomMemebers011313.zip CDtomMemebers011313.zip 26.3 KB · Views: 273 Last edited: Jan 13, 2013 Upvote 0
I think you best bet is to again zip you full project and export as zip and include the csv file as you have it, so forum users have a chance to test it on their devices. You probably also need to indicate exactly where you are storing the CSV file initially. Although I did not get an error when I ran it a few days ago even with the new fields, here are a few things to consider down the road when dealing with text files: 1. Avoid comma separated files when you have already commas in the field data. I saw that you have commas in some of the last names. The best way to use a text file when there are comma in the data is to use a TAB delimited text file or semi colon separated file. 2. Most data in that new text file have double quotes as a qualifier. You did not have that in your original text file that had fewer fields. I do not know if that can cause problems. ADDED: Here is zipped you program. It is exactly the way you posted it. I did not change any code except the package name. It ran for me. Here is what I did: 1. I Installed it on a Nexus 7 2. I copied the csv file you posted (the new one with the added fields) from my PC to the Download folder of the Nexus. 3. Ran the program. No error. Then I clicked on the Search Button. I was able to search. That is the extent of the testing I did. I did not do any other testing. I only tested to see if I get the same error you did. If you need your csv file, I can zipped for you also, but I assume you still have it.