Re: [IUG] Help with spine label templates and regex?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Date: Thu, 18 Sep 2008 10:12:49 -0400
- From: "KREYCHE, MICHAEL" <mkreyche at kent dot edu>
- Subject: Re: [IUG] Help with spine label templates and regex?
> -----Original Message-----
> From: innopac-bounces at innopacusers dot org
> [mailto:innopac-bounces at innopacusers dot org] On Behalf Of Anna Dundas
> Sent: Wednesday, September 17, 2008 3:01 PM
> To: INNOPAC at innopacusers dot org
> Subject: [IUG] Help with spine label templates and regex?
>
> We implemented Print Templates in the summer and the custom
> template we got from III works wonderfully for 80% of our
> labels. Problems occur when we try to print labels for our
> music compact discs. The locally-created call number scheme
> includes call numbers such as
>
> LC-T911
> Co
>
> and
>
> HZ
> C364.Ou
>
> We need our labels to break on the spaces, but not on the hyphens.
>
> Our current expression (in Jasper Reports) looks like this:
>
> $F{callAlphaStart} + ($F{callAlphaStart}.equals("") ? "" :
> "\n") + $F{callNumericStart} +
> ($F{callNumericStart}.equals("") ? "" : "\n") +
> $F{callNumericAfterDec} + ($F{callNumericAfterDec}.equals("") ? "" :
> "\n") + $F{callEndCR} + ($F{callEndCR}.equals("") ? "" :
> "\n") + $F{callSubbCR} + ($F{callSubbCR}.equals("") ? "" :
> "\n") +$F{itemv} +
> ($F{itemv}.equals("") ? "" : "\n")
>
> Unfortunately, it breaks on both spaces and hyphens. If I
> remove the substrings - ($F{callAlphaStart}.equals("") ? ""
> : "\n") etc., then the labels don't break on spaces or
> hyphens. I can't figure out how to get one but not the other!
The part you removed adds line breaks when the string is not empty. I think you need to replace this:
($F{callAlphaStart}.equals("")
with something like this:
(($F{callAlphaStart}.equals("") or $F{callAlphaStart}.endsWith("-"))
I'm not totally sure of the syntax--maybe "||" instead of "or", maybe more parentheses, but I'm pretty sure that's the direction you need to go.
Mike
--
Michael Kreyche
Systems Librarian / Associate Professor
Libraries and Media Services
Kent State University
330-672-1918