DataSum Ver. 1.0 for Psion 3a/c. Jan.1998.


What is DataSum?
   Let us assume that you are a stamp collector.
You have made a database of all your stamps and in your
records you have a field for "No. of stamps",where you enter
the number (incl. duplicates) of the particular
stamp pertaining to that record.You also have a field for
"Value" that indicates the total value of all the stamps (incl.
duplicates!) in that record.
   Now what do you do if you want to know exactly how
many stamps you posess and what the grand total value is
for this everchanging thousand-plus-entry collection?
The answer is simple:You use DataSum!
DataSum will read the (numerical) field of your choice,and
add up the values throughout the entire database,so in the
above example you would use it twice,on the fields "No. of
stamps", and on "Value" to get the total number and the
total value of the collection.
   DataSum can be used with any standard Psion database
containing fields with purely numerical information,where
it will be feasible to know the sum total of a particular field.
Examples could be databases of any kind of collections,and
of any kind of inventories.

Installing DataSum.
   The zip-file should contain the following files:

   DataSum1.opa       Main application as OPA
   DataSum1.opo       Main application as OPO
   Datasum.txt           This file
   File_id.diz              Short description
   DataSum1.opl        Source-code
   Sumtest1.dbf          Small database for testing

   There are two options for installation:
1. If you are about to run out of iconspace,just copy
Datasum1.opo to an \OPO\ directory on any drive (SSD ok).
The program will then be run from under the "Run OPL"
bubble in the System screen.
2. If you want the program to be run from its own icon in the 
System screen,like any other ordinary application,copy 
Datasum1.opa to any \APP\ directory and install from the
System screen in the normal way (using Psion-I).

Using DataSum.
   DataSum is a tiny program doing just one thing,and very
easy to use.After starting the program,a normal file selector
dialog will appear,allowing you to navigate directly to any
datafile in the normal DAT-directory.If you want to use it
for a file in any other directory,just use the standard Psion
filenavigator (press TAB while in the dialog).
After choosing the file,you will be asked to choose the field
to add up.The actual filenames will appear in this dialog.
When you have made your choice,adding starts
and you can follow the progress in a column to the left,
where the result is also displayed.Pressing any button at
this stage exits the program.
If you want to exit prematurely,press Psion-Esc.
   If the program meets with an error,it will stop and tell you
what sort of error it is,and if the error is ''Invalid arguments''
(the most frequent error) it will also tell which entry is faulty.
Pressing any button will then cause the program to exit
without doing any harm.

Errors.
   Virtually any error you will meet will be caused by a 
wrong entry in a field.DataSum will understand any
information that is purely numeric,if it is entered in the
correct format.
Here are some examples of allowed entries:
217
85.65
4.5583
3.456E3
2.41E-2
-48.15
-5.609E-3
And here are some that will cause an error:
2,45          (comma not allowed if your system-wide decimal
                 separator is set to be a point,and vice versa)
3.456 E3   (no space between number and E)
3.456E 3   (no space between E and exponent)
$ 439        (only numerals in the field!If a currency should be
                 specified,specify it in the field-name)
42.95*3    (no operators allowed.Make calculation before
                 entering value:Field should be total value)
                 No entry will raise an error.A 0 (zero) must be entered
                 if the value is zero.Likewise,if you inadvertently
                 type a "space" after a number (difficult to discover!)
                 the format will be wrong and an error raised.
There may be other entries that will raise an error,but this
should give you a general idea.
All the mentioned errors are of the type ''Invalid arguments'',
where you will be told the number of the faulty entry.

Legal stuff.
   DataSum is issued as freeware without support.(That is 
why so many words are being used for such a wee tiny
application!)
   You use DataSum entirely at your own responsibility,
etc.,etc.,etc.!
   You are free to use it as you see fit,and to distribute it as
you please,also with your own programs,provided that these
programs are also freeware.You are also free to make 
changes to the code (which is included),but if you want to
redistribute it,please find another name for it (and send me
a copy!)

Known limitations.
   As issued,DataSum will cater for databases with up to 12
fields and no more.If you have more fields than this,you
should make sure that the numerical fields of interest are
among the first 12,the only ones that are selectable.This
should suffice for the great majority of databases,but if you
have special needs you could make changes to the
source-code which is included together with a small test-
database that makes testing more simple.
   DataSum will work with normal,untampered-with,Psion
format DATAfiles,where fields are declared as "strings".
However,with the excellent freeware database-browser
JBData (downloadable from http://www.compulink.co.uk/~jbsoft/ ), 
and possibly with other programs as well,it is possible to
change field declaration to "integer","long integer" or
"floating point".If any field is thus changed,DataSum will
no longer work with that datafile!
   The fields in the database must have names,otherwise the
fieldselector will be confused,and an error raised.A single
letter or number will suffice.
   If there are any other limitations they have not yet been
encountered,but please let me know if you find any.

   You will probably find the source-code rather rude
since this is my first attempt in the noble art of OPL-
programming.However it is still a very small program,and
it does what it is supposed to do.

Acknowledgements.
   I have not invented the procedure that reads fieldnames
(wish I had! :-)).It is a piece of rather longhaired programming
I found in a collection of OPL-examples at New World
Technology (ftp://ftp.nwt.com).It seems to have originated
with a person of whom only his E-mail address remains known:
rjc@cogsci.ed.ac.uk.Whoever you are:Thanks for a nice
small procedure that solves a great problem!



I hope this program may be of some value to you.

Hail the freeware concept!


Poul Winstrom
Jan.97,Denmark


Bugs report to:
poul.winstroem@risoe.dk
