Jump to content
  • Calls to getName() on conditional styles always return null.

    Assigned User teodord
    CategoryBug report
    ResolutionNo Change Required

    Calls to getName() on conditional styles always return null.


    The JRBaseConditionalStyle implementation does not set the 'name' attribute in its constructor. This makes it impossible to uniquely identify a conditional style in order to apply dynamic formatting programatically.

    User Feedback

    Recommended Comments



    What you are trying to do is not quite correct.

    Conditional style have a meaning only at report design time and not in the generated report (JasperPrint object).


    It is true that our engine preserves style objects when the JasperPrint object is generated and indeed those styles coming from the report design continue to have conditional styles in them. But those are like dead objects which do not count in the styling of the JasperPrint content.

    Modifying a conditional style inside a JasperPrint object has no effect whatsoever.


    From a report design point of view, the name of a conditional style is irrelevant and sometimes it is confusing. This is why recently we have put some warnings when the JRXML file is parsed, to let the users know that some attributes in the conditional style tag are not used by the engine and should not be present.






    What you need to understand is that conditional styles contribute to the creation of some consolidated style names, depending on which conditions apply at runtime. You can look into the JasperPrint object and see some styles that have calculated names ending with 1 (one) and 0 (zero), depending on which conditions where met when the conditional styles were evaluated at runtime. It is those consolidated styles that you probably want to look for in the JasperPrint and modify using the API.


    I hope this helps.


    Link to comment
    Share on other sites



    In that forum thread, the discussion was about conditional styles in the source JRXML. But in this tracker here, you showed us you are actually looking for them in the generated JasperPrint object. Which is a different thing, as explained above.


    I wonder if looking for conditional styles by their known index is not something you could do.


    I'm closing this for now. Feel free to reopen it if you have new information about this.


    Thank you,


    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...