Page 1 of 1

Conditional shape coloring in report

Posted: Fri Mar 28, 2014 4:35 pm
by clausisme
I have a shape and I want it to change color corresponding to a data field. For instance I have a query with 5 category's (cat=1, cat=2 etc) and for each category I want that shape to have a different color.
I tried writing in the "conditional shape expression" many variations of this:
=IF([Cat]=1;Shape.FillColor=RGB(100.200.300))

I am a new user of openoffice and I don't have a grasp of the syntax needed. I know how to Conditional format a text but can't use Format>Conditional Formatting on a shape.

Re: conditional shape coloring in report

Posted: Fri Mar 28, 2014 5:02 pm
by acknak
Nice try!

Unfortunately Writer's fields are fairly primitive; you can't use shapes in a formula (see the online help under Index > "formulas;calculating in text" > "Formula bar" for more info.

Here's one way to do it: create the shapes with the colors you want, each shape anchored "as character" and in its own paragraph, then add a "hidden paragraph" field to each paragraph with the condition needed to hide the paragraph unless the condition is met.

Here's a sample arranged this way:

Re: conditional shape coloring in report

Posted: Sat Mar 29, 2014 1:48 pm
by clausisme
Thanks for the prompt reply.

I am using the sun report builder in OpenOffice base, and can't really see how to make your example happen there. Maybe it would work in the old wizard report builder. But I really need a solution in the sun report builder if there is any.

Re: Conditional shape coloring in report

Posted: Sat Mar 29, 2014 3:57 pm
by acknak
I thought the report builder just constructed a Writer document--can't you edit the report in Writer and make whatever changes you need?

I don't know; I've never touched the report builder so I could be completely off track.