inside

0

I need to create two condition in a style that this work with a single datasorse's value. If a value is "IsBold" the text must be bold, but If the values is "IsEnclosed" the cell of the field must be framing

    <style name="styleNegraLineaLeft" style="row_style" radius="1" markup="none" pattern="" isStrikeThrough="false">
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($F{flgIsBold}==1)]]></conditionExpression>
            <style isBold="true" pdfFontName="Helvetica-Bold"/>
        </conditionalStyle>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($F{flgIsEnclosed}==1)]]></conditionExpression>
            <style mode="Opaque" backcolor="#808080"/> <---- I need replace this
        </conditionalStyle>
    </style>

 

                            <textField>
                                <reportElement style="styleNegraLineaLeft" x="0" y="0" width="80" height="6" uuid="ff3dc74b-74a8-40cf-b548-60b6592f6a41"/>
                                <box topPadding="0" bottomPadding="0">
                                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textFieldExpression><![CDATA[$F{conceptName}+"["+$F{flgIsBold}+":"+$F{flgIsEnclosed}+"]"]]></textFieldExpression>
                            </textField>
 

 

Here will there be a soul that takes pity on my misery?

 

 

sacunam's picture
Joined: Apr 29 2019 - 7:04am
Last seen: 2 weeks 6 days ago

3 Answers:

0

Do you want to set the background color itself to a dynamic value or just that the TextBox has a colored background (the fixed color defined in the conditional style) ???

The first one isn't possible in the design, because the background-color is a static value and not an expression. So here you could use a scriptlet or something else to dynamically change the color value depending on a fieldvalue.

If just the predefined color from the condition isn't working, then try to delete all the box settings from the TextField.
I assume, this will override your conditional style settings, as it's explicitly set at the TextField.

Not tried... but worth to give it a try! :-)

hth + regards

C-Box

C-Box's picture
1434
Joined: Jul 19 2006 - 5:58pm
Last seen: 21 hours 10 min ago
0

Thank for the interest. 

 

I really need to frame a TextField conditionally

sacunam's picture
Joined: Apr 29 2019 - 7:04am
Last seen: 2 weeks 6 days ago
0

Still not clear if:

A) just the opaque flag with the static background (e.g #808080 )  color should appear by a condition for a certain fieldvalue

or

b) the background-color itself depends on a condition (e.g. $F{someField}.equals("x") --> color = #808080  ...$F{someField}.equals("y") --> color = #505050  ....

or

c) the background-color itself should come from another field-value (e.g. $F{backgroundColor} )

??????

regards

C-Box

C-Box's picture
1434
Joined: Jul 19 2006 - 5:58pm
Last seen: 21 hours 10 min ago
Feedback
randomness