Jump to content
We've recently updated our Privacy Statement, available here ×

Conditional Style - change the background of column groups based on one of the column groups value.


P.M

Recommended Posts

Hi,

I am new in jasper and I am asking for a good way of changing the background of the column groups (including the value_measure column) based on a value from another column group. So I have created 3 conditional styles like this:

<style name="Colouring Style" mode="Transparent" backcolor="#FFFFFF">
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{Component Group} == "Soil Summary Data"]]></conditionExpression>
            <style backcolor="#A7DB67" markup="styled"/>
        </conditionalStyle>
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{Component Group} == "Supplementary Analyses"]]></conditionExpression>
            <style backcolor="#91B7ED"/>
        </conditionalStyle>
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{Component Group} == "Recommendations"]]></conditionExpression>
            <style backcolor="#FAFC53"/>
        </conditionalStyle>
    </style>

and I have further applied them to the component_group column like this:

<textField isBlankWhenNull="true">
                                <reportElement style="Colouring Style" mode="Opaque" x="0" y="0" width="97" height="15" isPrintInFirstWholeBand="true" uuid="1566d388-bea1-4bd0-afb1-435d1bbcc013"/>
                                <textElement textAlignment="Center" verticalAlignment="Top" markup="styled">
                                    <font fontName="Calibri" size="11" isBold="true"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$V{Component Group}]]></textFieldExpression>
                            </textField>

 

Now I have checked the transparent checkbox on style and unchecked transparent property on the crosstab column group I have used but still it seems like the style is not working. I have tried to use the ${COLUMN_COUNT} variable but it still does not apply the backcolor to the crosstab. Can anyone help me with this? Another thing is I would like to change the colour of coloumn groups below the component_group column group (I have attached an image file for clarification). Please help, you are free to ask for further clarifications if my question is not clear enough. Thank you in advance. 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Try this:

 

<style name="Colouring Style" mode="Opaque">
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{Component Group} == "Soil Summary Data"]]></conditionExpression>
            <style backcolor="#A7DB67" mode="Opaque" markup="styled"/>
        </conditionalStyle>
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{Component Group} == "Supplementary Analyses"]]></conditionExpression>
            <style mode="Opaque" backcolor="#91B7ED"/>
        </conditionalStyle>
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{Component Group} == "Recommendations"]]></conditionExpression>
            <style mode="Opaque" backcolor="#FAFC53"/>
        </conditionalStyle>
    </style>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...