Trying to set either color or visibility in Crystal Reports project RRS feed

  • Question

  • Hello All,

          I have a Crystal Reports project open in VS 2008, so I am working with all .rdl files inside of VS. What I need - is to either set the background color of a rectangle object or make one of several different colored rectangle objects visible based on the value of a field.  The field is displayed in a text box next to the rectangle object, and is coming from a dataset.

          Problem - as far as doing this with a formula editor or custom code, I am a newbee. I've tried everything I could find on the net on forums, blogs, etc. with no luck.  I tried writing a custom function in the code window of the report properties page, but Code and the name of the function are both unrecognized identifiers when trying to access them from a formula editor.

          How can I make this work with a Crystal Reports project versus full Crystal Reports?

    Thanks very much in advance for your help!


    James D. Angielczyk
    Monday, July 18, 2011 8:07 PM

All replies

  • You have to use a formula thats the best option available please share the screenshot of the formula you have tried for the box

    and as far as i know we cant write a formula for a box object so i think you must be using a blank text box as a rectangle and then filling its background using a formula


    Surender Singh Bhadauria


    Tuesday, July 19, 2011 8:20 AM
  • Hi James,

    CR Basic for VS 2008 is version Crystal Reports version 10. IT doesn't allow you to do reports changes other than record selection and DB updates mostly. The Report engine you need it RAS, Report Application Server, and is include in full versions of Crystal Reports or if you can upgrade to VS 2010 you can now get a nearly complete, including RAS, version of Crystal Reports for Visual Studio 2010. You can then get full access to CR and all of it's features as well as a few more enhancements.

    For samples see these: http://wiki.sdn.sap.com/wiki/display/BOBJ/Business+Objects+SDK+Sample+Applications

    Or as suggested you need to handle them using formulae in the report itself.


    Don Williams
    Tuesday, July 19, 2011 1:57 PM
  • I added a text box, right clicked on it and chose text box properties. I selected Fill and next to Fill Color is a function button.  I clicked on it and got a formula editor box - Set Expression for :backgroundcolor.  "Transparent" was already populated.  I changed it to this:

    if{Fields!Priority.value} = Low then Green

    else if {Fields!Priority.value} = Medium then Yellow

    else Red


    When I click Ok, I get "

    if{Fields!Priority.value} = Low then Green

    else if {Fields!Priority.value} = Medium then Yellow

    else Red is not a valid color."

    I realize this is a stripped down report engine, but it ought to let you do something as simple as that.

    If the other poster is correct, then I can't do it and I have to give up for now.  I don't have the luxury of downloading or upgrading to anything else just now.


    Thanks again.

    James D. Angielczyk
    Tuesday, July 19, 2011 2:47 PM

    Hit the F1 key when in design mode and you should get the Designer help file:


    The color black.
    The color maroon.
    The color green.
    The color olive.
    The color navy.
    The color purple.
    The color teal.
    The color gray.
    The color silver.
    The color red.
    The color lime.
    The color yellow.
    The color blue.
    The color fuchsia.
    The color aqua.
    The color white.
    No color.



    Don Williams
    Tuesday, July 19, 2011 3:24 PM