Report (label) has leading zeroes in string catalog number

In Specify 6, the catalog number on the label is printing without leading zeroes, but in Specify 7 it prints with leading zeroes.

I have tried to convert the string to an integer like this, but it didn’t work.

Does anyone know how to remove the leading zeroes?

Hi @willem,

Thanks for your question! Your expression will result in an error since the catalog number field is considered a string and not an integer.

In Jaspersoft Studio, I created an expression that parses the catalog number appropriately so you can effectively remove the leading zeros. See below:

Without Expression

$F{1.collectionobject.catalogNumber}

In Specify 6:

$F{Catalogue_Number}

With Expression

String.valueOf(Integer.parseInt(((String)$F{1.collectionobject.catalogNumber})))

In Specify 6:

String.valueOf(Integer.parseInt(((String)$F{Catalogue_Number})))

Does this solution work for you?

1 Like

It certainly does - thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.