In my jasper report, I am using elements something like this:
<textField isStretchWithOverflow="true">
<reportElement style="alternateStyle" positionType="Float" stretchType="RelativeToTallestObject" x="292" y="0" width="85" height="30" uuid="b93b4e99-d6fb-4679-836d-9b198cb5fe1c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SMCustomFont" size="9" isBold="false"/>
<paragraph leftIndent="3"/>
</textElement>
<textFieldExpression><![CDATA[($F{SOMEEXP}]]></textFieldExpression>
</textField>
Here the uuid is "b93b4e99-d6fb-4679-836d-9b198cb5fe1c".
My question is What happens if I keep the UUID same for some other textField element in the same JRXML file and what is the significance of UUID?
When I tried, the report is generating fine.
Jasper reports use the UUID
in the engine to identify elements, see for example SortElementJsonHandler.getCurrentSortField
.
A Friendly User (staff) at the Jasper Community forum states
UUID is used mostly for the interactive elements like tables and crosstabs to identify the elements for sorting/filtering/etc. It's used in the viewer and on the engine level, I am not sure there is useful API available to interact with elements using UUID.
Also as far as I can see, in most simple cases like two textField
there is no problem having same UUID
, but you can get strange result if you have a more complex design with multiple similar components and all of them have same UUID
If you copy and past elements/components in the raw jrxml, either change a number or remove the UUID
, when saved in JasperSoft Studio it will auto-generate it for you if it does not exists. Overall I would suggest that you use the IDE for all actions (copy and past etc), personally I only use the code/jrxml view if I need to do some quick replace of something etc.