Can you make it available in text format so I can read through it. Or in a non zipped file format?
Use this link instead:
The download starts immediately and you will get a zip file called CSVframework.zip.
The zip is opened and load the file “CSVframework.xojo_project” (from the generted folder) and run.
Then, click i the main window’s first button, locate a csv file and select it / and click in the second button.
After that, you can go to the code to know what it do.
OK .... here are two more links. One for the Xojo binary project and one for a sample INI file. Both are NOT ZIPPED. You should be able to load the CSVframework.xojo_binary_project directly into the Xojo IDE. You can open the MyConfigSettings.ini sample file with notepad.
Let me know if you have trouble with these links and I will do something else.
Thank you Mark. I managed to load it into Xojo and am looking through all the code. Going to take me a while to understand I'm sure. The csv files I access do not have column names in the first row. We have the data file map and code off of it.
Sure I am going to have questions. I'll be back...LOL
By the way. I did go ahead and buy the xDev magazine with the Xojo beginners article.
Since you don't have column names you can comment out that chunk of code in the FindTheFile method BUT you will also need to modify the data load method (LoadArray) since it assumes the number of names in the first row to be the number of columns in the data portion of the file. You can just modify the code like this:
'Loop through the input row based on the number of columns found when ' the first row was processed by the FindTheFile method. for i = 0 to ColumnNames.Ubound
'To this code since the ColCount is already calculated a few lines above here
'Loop through the input row based on the number of columns found in ' the data row just read. for i = 0 to ColCount
I hope this helps you get this modified to work with your data.
One thing I noticed. You have file type and extension listed as CSV. But the files I use are extension jcp, made the change with no problem. But end users will access drf, or jcp or mcp depending on what data file provider they use. I tried to add all three in place of the csv and it didn't work. How do I include all three extensions?
@milford w One thing I noticed. You have file type and extension listed as CSV. But the files I use are extension jcp, made the change with no problem. But end users will access drf, or jcp or mcp depending on what data file provider they use. I tried to add all three in place of the csv and it didn't work. How do I include all three extensions?
Mark's response is correct but if you're on Windows it seems that the leading dot is necessary, as in:
I don't understand why a bug shows up here.
'Open the input file
InPath = INIfile
InFile = new FolderItem(InPath,FolderItem.PathTypeNative)
*** BUG HERE*** InStream = TextInputStream.Open(InFile)
catch err as IOException
er = "Input File Error : " + str(err.ErrorNumber)
INIfile is the full path to a configuration file that contains info your program might need. I included this code in the sample because I figured you might need to handle a configuration file in your final code.
The error is probably because the file is missing in the folder where the EXE file exists when you are running it in debug mode.
The INI File that I included called MyConfigSettings.ini is assumed to be in the same folder with the EXE file. The CopyFile setting in the Build Settings should copy the sample file to the same place the EXE file. Based on how you set up your folder structure is probably the issue.
For now just comment out the call to the INIfunctions.GetKey in the App.Open event.