After we now know how to access an Archivista database we would like to show an exemplary case of how to locate bitmap pages with an SQL query and a few commands in Perl.
The code above shows how the file name is calculated from the document
number and the page number in that document.
To calculate the complete path of a page we in addition need the type of
the document and the folder where it lies. The type of the document is to
be found in field 'ArchivArt': 0=BMP/ZIP,1=TIF,2=PNG and 3=JPG. The
folder number is to be found in field 'Ordner.'
One other thing must be paid attention to: has a document been archived or
not? The field 'Archiviert' in table 'Archive' tells us. If yes, the page
will no longer be found in the input folder but it will reside in the
output folder. The folder of a document that has not yet been archived can
be located by the following procedure: a) it must be in the input directory
b) its number is the result of taking the remainder of modulo 100 of a
document number (e.g. the remainder of 1725 would be 25).
Two more examples:
Page in input folder: Document 1, page 1 with A copy and value '1'
in field 'ArchivArt' you find in '..\input\in001\A0000B0B.TIF'.
Page in output folder: Document 2, page 3 with B copy and format
'JPEG' has already been archived and lies in folder '1' (field 'Ordner,'
English: 'folder'). This page is to be found in '..\output\ARCH0001\B0000C0D.JPG'.
sub GetDateiName {
my $modus = shift; # A or B copy
my $akte = shift; # document number
my $seite = shift; # page in question
return $modus . FileName($akte,5,) . FileName($seite,2);
}
sub FileName {
my $eingabe = shift;
my $anzahl = shift;
my ($res,$res1,$out);
while ($eingabe != 0) {
$res = $eingabe % 26;
$res1 = $res + 65;
$out = chr($res1).$out;
$eingabe = $eingabe - $res;
$eingabe = $eingabe / 26;
}
$out = "0" x ($anzahl - length($out)) . $out;
return $out;
}
The Archivista PublishingEdition offers
more clues as to how to communicate with an Archivista database. It gives
you the complete source code (including correct login) for communicating
successfully with Archivista databases.