Editing get_dla_list.pl

Hi. Does anyone know how to edit the get_dla_list.pl script to produce a comma delimited output rather than tabbed. Also how can I add the default column headings for item barcode, title and classmark. Anyone had any experience of modifying this script?

editing get_dla_list.pl

There is a section of the script

#
# Run SQL
#
(@items) = sql($d, $sql, "\t");

The \t is indicating to separate the attributes returned by tabs. Replace \t with , and you will get a comma delimited file. Although there will be no text qualifier in use so if the title or author has a comma in that is going to throw the whole thing out. If possible I would use a different delimiter e.g. | (pipe symbol) than a comma.

To add some headings then add a line before

for $item (@items) {
print "$item\n";
}

e.g.

print "Barcode,Title,Classmark\n";

for $item (@items) {
print "$item\n";
}

Modify the names in the first print command as required.

However there is a limit to what you can do with SQL directly. More formatting can be done within Perl. Please see the Creating a CSV file of borrower information article for an example of this. While the article talks about borrower information the principles can be extended to item information as well.

Thanks

Brian Crampton
Developer, Talis

Thanks Brian, that works.

Thanks Brian, that works. Just when I thought we had got everything working, it turns out that each entry in the report produced by the script needs to be quoted, ie "Item Barcode"|"Title"| and so on. Do you know it's possible to add this to the script?

Editing get_dla_list.pl for site codes

Hi I've been using the get_dla_list.pl script to pull out lists of reserved items and queries, but want to pull out all items for 4 out of 6 sites. I can do individual scripts for this but would prefer to use a single command line if poss. My script to produce a list of reserved items for site fa is as follows:
/users/talis/pscripts/BNget_dla_list.pl fa reserved >/scratch/FAreserved.txt

I need to change the reserved variable to all and want to replace fa with 4 site codes, but I can't get the syntax right. I've tried variosu things like separating with commas, using quote marks, etc.Can anyone advise me?

Thank you!

Claire

Claire Eskriett
Systems Librarian
Library Technical Services
University of Brighton

get_dla_list.pl script

The script wasn't designed to accept multiple site codes in the command line but can be set up within the script. I think this is correct but I haven't tested this.

The default configuration is shipped in a section that looks like

%valid_siteparam = (
'n' => "'N'",
'sg' => "'SG'",
'gp' => "'GP'",
'cm' => "'CM'",
'mu' => "'MU'",
'hh' => "'HH'",
'ic' => "'IC'",
'all' => "'N','SG','GP','CM','MU','HH','DC','NG','DV'",
);

You will have needed to modify this for your sites.

The all option can be whatever sites you like or you can define a new grouping. I have just guessed values in the following example but subset would contain the four talis location codes

%valid_siteparam = (
'n' => "'N'",
'sg' => "'SG'",
'gp' => "'GP'",
'cm' => "'CM'",
'mu' => "'MU'",
'hh' => "'HH'",
'ic' => "'IC'",
'all' => "'N','SG','GP','CM','MU','HH','DC','NG','DV'",
'subset' => "'FA','S2','S3','S4'",
);

The line would be

/users/talis/pscripts/BN/get_dla_lsit.pl subset all >/scratch/SubsetAll.txt

The second value is a different "all" than the first value so you can potentially have all twice on the command line.

Thanks

Brian Crampton
Developer, Talis