Import into Grade Book

Make comments, ask questions, or just complain about the software on this site. Or comment on any educational software.
Please note that by clicking on links that may appear in these posts that you may be leaving the Dale Harris Educational Software website and that the content of those sites is the sole resposibility of the authors of those sites.

Moderators:daleadmin, Dale Harris, Alan, Andrew

Post Reply
User avatar
Dukane
Forum Regular
Posts:147
Joined:Mon Jun 21, 2004 11:00 am
Import into Grade Book

Post by Dukane » Sun Apr 28, 2013 12:11 pm

Hi Dale,

Is it possible to import a class roster from a CSV file into your Grade Book application?

User avatar
Dukane
Forum Regular
Posts:147
Joined:Mon Jun 21, 2004 11:00 am

Re: Import into Grade Book

Post by Dukane » Tue May 07, 2013 3:54 pm

Yes? No? Maybe so??

User avatar
brucef2112
Forum Regular
Posts:336
Joined:Mon Mar 06, 2006 11:19 pm
Location:Broward County, Floriduhh
Contact:

Re: Import into Grade Book

Post by brucef2112 » Tue May 07, 2013 6:25 pm

Ok, no other takers.
I'll try to help ya. The answer is "Yes" it can be done.

Now, here are some questions for you to answer in order to help.
1. Are you running this on a Windows OS using 'cmd' or an old but true version of DOS?
if in Windows OS, do you have MS Excel?
2. Does your CSV student raster file have quotes around the students names or not?

Code: Select all

"John"
"Jack"

or

John
Jack
3. is the students name in a single field like in the Grades program or does the CSV have the first and last name in separate columns. ie by "," Comma (or TAB)?

Code: Select all

"John Jones"
"Jack Ripper"

OR

"John", "Jones"
"Jack", " Ripper"
Or is it some combination of the above examples?
Let me know
Later,
Bruce

They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
Benjamin Franklin - Historical Review of Pennsylvania, 1759

User avatar
brucef2112
Forum Regular
Posts:336
Joined:Mon Mar 06, 2006 11:19 pm
Location:Broward County, Floriduhh
Contact:

Re: Import into Grade Book

Post by brucef2112 » Mon May 13, 2013 12:26 am

I have written a program to convert CSV file to .NAM files that can then be imported into Dale Harris' Grade Book program.
It is writen in a DOS batch. But it must be run on a Windows XP or higher OS. Once converted, the files can be copied and used on a DOS OS computer (minding the 8.3 file names)
It started out a a couple lines but expanded to handle various formats of source files.
It was challenging to write it using only DOS command functions.

I doubt the audience is large for this specific use (Probably in the 1's of people). However others may just want to take a look at it for its methods of text file reading and string manipulation as a jumping off point for other purposes you may have in mind. YMMV.
The zip file can be downloaded here http://www.pahandmahjongg.com/pos/csv2nam/csv2nam.zip. It contains a single file called csv2nam.bat.

To use the program, type the batch file name (csv2nam.bat) followed by the source.csv file.
ie csv2nam myData.CSV
Once started, the program displays the first line of your .CSV file and prompts you to answer;
"Is the first row contain Column Headers or data". It then determines the data format of the .CSV and creates the .NAM file(s).

You do not have to run this from the same directory your Grade Book program is in.
However the resulting .NAM files will eventually need to be in the directory of your GradeBook so you can import them using Gradbook.exe, so it is suggested to just put the conversion program and your .CSV in your gradebook directory and run it from there. ie C:\GRADBOOK\

As stated above, the program can accommodate .CSV files with, or without, a Header row. You just need to answer the Y/N question about the first line of data when prompted.

As CSV file formats dictate, each name is on its own row.
Your name data can be in one column or two columns of data.
The names can be in any of the following formats.
1. Entire name in quotes: "FirstName LastName"
2. Quoted Fname Lname separated by commas (ie two columns): "FirstName","LastName"
3. Quoted name containing commas within the quotes: "LastName, FirstName"
4. Un-quoted name separated by commas (ie two columns, no special characters in names): FirstName,LastName

(This last one is typical of an Excel export to a DOS .CSV file if data doesn't contain any special characters.)

The original .CSV file is only used to read from and is never changed by the program.
Files are created conforming to the .NAM format for use with DH Grade Book program.

The resulting .NAM file will have the same name as the source .CSV. ie Mydata.CSV will produce a Mydata.NAM file.
As you know, the Grade Book program only allows 35 names per class. IF your source CSV file contains
more than 35 names then the .NAM file output will be a series of files. Example, If your CSV contains between 71 and 105 names. the program would output files named Mydata_1.NAM, Mydata_2.NAM, Mydata_3.NAM. Specifically for the Grade Book program, it doesn't make sense unless you pre-padded your CSV with 'something' on the 'empty' lines to make it break on each class at 35. But from a programming view it shows how to chunk a single data set into multiple output files. Note that you can't just pad with empty lines in the CSV. Blank lines are skipped. IE. you have 20 names for a class1 and 30 in class2, you would have to enter a character like"]" on each line from 21 to 35 if you wanted the process to break on your next class of students for them to end up in the second file. If you choose this method, and I can't imagine why, don't use characters like * & ^ | / as the 'padding' character (ie special characters used by the command interpreter). A "]" is a safe one to use, and they're cheap!
OR what I would do is to have individual CSV files for each class and run each one through the conversion. hhmmmm.

For the 1's of people who are going to use this with the Grade Book program. Here is what to do with your newly created .NAM files.
Place the .NAM file(s) in your Grade Book directory, use the Grade Book Import program (the [F12] Key) to import the individual .NAM files.
1. From the main menu select 1.Grade book.
2. If "MAP OF THE GRADE BOOK" pops up, hit [Esc]
3. Hit the [F12] key.
4.At the bottom of screen you will see several choices. One of which is; [F1] Load a NAMES file previously saved.
Hit the [F1] key.
5. Type the name of the file to import. Hit [Enter]. Names will be imported in a blink!
6. You are then prompted to; Delete the file Y - N. Choose [Y] or [N]
7. Then hit [ESC] to Return to entering scores.
You are done!

For those hacking around with the code, be forewarned!
1. Something as simple as a misplaced <space> will break that which once worked. (Not knowing you placed it, makes finding that <space> really hard)
2. The FOR command is very unforgiving about its syntax and multi-line format.
3. Double quotes sometimes need to be escaped but not always.
4. Be sure to know why to keep SETLOCAL ENABLEEXTENSIONS and SETLOCAL enabledelayedexpansion.
5. Be sure you understand the difference of using %myVar% and !myVar!at different parts of the code.
6. If your using remarks inside FOR's; use the o'l skool 'REM' instead of : or ::. The later will break your FORs.
7. Multi command IF statements or nested IF statements are also unforgiving about their format.
8. Be sure you understand the difference of %ERRORLEVEL% and ERRORLEVEL befor relying on them for logic in your code. ohh throw in !ERRORLEVEL! too.

Any questions?
Later,
Bruce

They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
Benjamin Franklin - Historical Review of Pennsylvania, 1759

User avatar
brucef2112
Forum Regular
Posts:336
Joined:Mon Mar 06, 2006 11:19 pm
Location:Broward County, Floriduhh
Contact:

Re: Import into Grade Book

Post by brucef2112 » Thu May 16, 2013 9:40 pm

OK, i have way too much free time. :(
I've made major improvements to the code. Took a bunch of mess out and added a new feature.

Now, along with all the csv file formats listed previously, I've modified it so you can also have your names listed in up to three columns of data.
ie
"FirstName Lastname"
or
"FirstName","Lastname"
or
"FirstName","Middle","Lastname" < NEW FEATURE

Of course if you data is in one column as "FirstName Middle. Lastname" that's fine too! Along with not having any quotes around your data and just commas. And if it's no comma no quotes (not really a CSV, but) it will do that in too.
First row can contain your column headers or no column headers(ie first row contains your data).
The zip file now contains some test csv files
one has a single column of data with 77 names.
This show how the data is saved to sequential named files. (35 names per file. remaining names in last file) file1 file2 file3
another has 2 columns
another has 3 columns

Download it here
http://www.pahandmahjongg.com/pos/csv2nam/csv2nam.zip


Any questions?
Later,
Bruce

They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
Benjamin Franklin - Historical Review of Pennsylvania, 1759

User avatar
Dukane
Forum Regular
Posts:147
Joined:Mon Jun 21, 2004 11:00 am

Re: Import into Grade Book

Post by Dukane » Tue May 21, 2013 4:45 pm

Thanks Bruce, I had put this project off tot he side for a while, but will take another look at it again in the coming days. Thanks for your help and I will get back to you with any questions I find on the way,

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests