Formatting parts of formulas with crBold and other functions

Hi,

I created a simple formula using ‘if’ ‘else’ conditions and would like to know how I can conditionally format the output strings. Here’s the sample:

if {?TestParam}=“Condition1”

then

“Dear John,” + chr(10) + chr(10)

  • “blah blah” + chr(10)

  • “blah blah blah”

else if {?TestParam}=“Condition2”

then

“Dear Jane,” + chr(10)

  • “Thank you for your order.” // How do I make this Sentence BOLD?

  • “blah blah blah”

else if {?TestParam}=“Condition3”

then

“blah blah blah” // How do I CENTER this sentence only?

I tried using CRBOLD() , but it gives error. And also, there’s a crCenteredHorizontally function I believe I tried using and that didn’t produce any result.

Is it even possible to conditionally format parts of the strings within a formal?

Thanks a lot for your suggestions.


exile (BOB member since 2008-05-03)

Hi exile,

I have done quite a few reports that were letters for various types of companies. Typically I wouldn’t try to do the way you are doing it.

The way you can accomplish conditionally formatting would be this:

  1. Create a DearJohnOrJaneStatusFlag formula to tell you whether this row should be for john or jane.

  2. Create a (from your examples) DearJohnName formula and a DearJohn dearJohnTextbox with the wording you want.

  3. Then create a DearJaneName formula and a DearJaneTextBox with the wording that you want.

  4. In the DearJohnTextbox insert the dearjohnformula with all the text that you want.

{dearjohnformula}, we love you and blah blah blah.

In the DearJaneTextbox insert the dearjane formula with all the text you want.

{dearjaneformula}, we miss you and blah blah blah.

Now place both text boxes in the same place on the report. One on top of the other.

Right click each box and check the suppress button and then click on x-2 button.

On the dearjohnbox, enter the x-2 formula"{DearJohnOrJaneStatusFlag} = “Jane”.

On the dearjanebox, enter the x-2 formula"{DearJohnOrJaneStatusFlag} = “John”.

Now, only one will show at a time.

The reason I like this approach is because when I am formatting the actual wording in the text box, I can highlight as I want. For example:

{dearjaneformula}, we miss you and blah blah blah.

I hope that helps.

Tony


webtechie :us: (BOB member since 2007-10-10)

Hey Tony,

Thanks so much for your help. I’ll create my second report using your method. I have like 12 conditions, but it could be done the same way I. I really really appreciate this.

Thanks! 8)


exile (BOB member since 2008-05-03)