Jasperreport - Passing Objects to report column

Asked

Viewed 48 times

0

I have to take the dice from the following field :

venda.getVendacardinalidades().get(0).getUsuario().getPessoa().getNome()

And put this value in a report column, how do I do that:

I was trying to do this:

<field name="nome" class="com.vendas.model.VendaCardinalidade"/>
...

<textField isStretchWithOverflow="true">
    <reportElement x="0" y="0" width="187" height="20" forecolor="#666666" uuid="47de42ee-e4c9-4c89-9d64-03fb5ecb4fb6"/>
    <box rightPadding="2"/>
    <textElement textAlignment="Justified" verticalAlignment="Middle"/>
    <textFieldExpression><![CDATA[$F{nome.getVendacardinalidades().get(0).getUsuario().getPessoa().getNome()}]]></textFieldExpression>
</textField>

But it goes wrong, how to do this? Thank you in advance!

1 answer

0

I got it through logic:

I did so:

<field name="vendacardinalidades[0].usuario.pessoa.nome" class="java.lang.String"/>

...

<textField isStretchWithOverflow="true">
    <reportElement x="0" y="0" width="187" height="20" forecolor="#666666" uuid="47de42ee-e4c9-4c89-9d64-03fb5ecb4fb6"/>
    <box rightPadding="2"/>
    <textElement textAlignment="Justified" verticalAlignment="Middle"/>
    <textFieldExpression><![CDATA[$F{vendacardinalidades[0].usuario.pessoa.nome}]]></textFieldExpression>
</textField>

Straight!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.