Conditional shape coloring in report

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
clausisme
Posts: 24
Joined: Fri Mar 28, 2014 3:23 pm

Conditional shape coloring in report

Post 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.
OpenOffice 4.01 on Windows 7
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: conditional shape coloring in report

Post 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:
Attachments
alternate_shapes_sample.odt
(9.59 KiB) Downloaded 330 times
AOO4/LO5 • Linux • Fedora 23
clausisme
Posts: 24
Joined: Fri Mar 28, 2014 3:23 pm

Re: conditional shape coloring in report

Post 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.
OpenOffice 4.01 on Windows 7
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Conditional shape coloring in report

Post 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.
AOO4/LO5 • Linux • Fedora 23
Post Reply