Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional font size for field within text object 2

Status
Not open for further replies.

wmiller1

Technical User
Joined
Jun 2, 2005
Messages
5
Location
US
Bug? - looking for workaround (or fix!).

Steps to replicate:
1. Insert Text Object in Detail section.
2. Insert a field into Text Object.
3. Conditionally format the field to change font size. Example:
if {db.ID}>200 then
formula=20 else
formula=DefaultAttribute
end if
4. Refresh - it will work fine.
5. Try to edit conditional formula. It won't be there, but will still work.

Clue - It appears to be inserting the formula from Font Style. To replicate, enter a formula for Style. Refresh, then edit the Size formula. The Style formula will appear in the "Size" editor. If you save it, everything gets screwed up (looks like a font size of 1 - really small).

Outside of a Text Object, Conditional Font Size formatting appears to work as it should.

Looking for confirmation and solution. Thanks!


 
Yes, I see that the size formatting disappears--but I don't see it appear somewhere else or use a formula from somewhere else. A workaround is to set up the formatting formula like this (using Crystal syntax):

numbervar x;
if {db.ID}> x then
20 else
DefaultAttribute

Set the value of x in a separate formula in the report header:

numbervar x := 200;

-LB
 
LB - thanks for the confirmation of the first part. I don't think your solution works though - maybe I'm doing it wrong. Can you confirm that it works?

Regarding replacing with the Style formula, add this as a conditional Style:
if {db.ID}>200 then
formula=crBold else
formula=DefaultAttribute
end if

When I refresh and then look at the Font Size formula, the style one appears (it also appears, correctly, in Style). ?Thus, the problem. The workaround you propose does not seem to solve.

Other suggestions - or am I missing something? Thanks.




 
Why the "formula ="? This makes no sense. Also the "EndIf" makes no sense unless you are using Vb syntax maybe?

Try LB's formula in crystal syntax, it works in 8.5 and higher.




Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
Hi,
Looks like a real bug..Only seems to affect objects within text boxes. Perhaps the 'nested' nature of the text object creates a problem..

Note: It behaves that way in CR10 and CRXI R2

Time to contact Business Objects support....



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
To confirm ( tested in both CR10 and XI R2):

When a formula is used to conditionally set a font attribute of a field within a text box, the formula gets replicated in the Font size formula editor..

so if I set

Code:
If {table.Barg_Unit} = '220' then
crBold
else
crRegular

for the x*2 entry for Font STYLE, it shows up in font SIZE as well when the data is refreshed and makes the text unreadable...This only happens if the formatted field is within a text object...





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I agree that this buggy behavior does occur--just tested.

But I WAS able to then change the conditional formula for font size back to the font size language. Then when I changed the value in the report header variable (see my last post), the text box formatting appeared correctly based on changes in that formula.

-LB
 
Hi,
I see..But If I want to use a value in the {table.field} as a condition, not just some number, how can I get that to work?
I like to highlight certain fields based on their content in a particular record...It works fine outside of the text object, so I just avoid using those when I need that functionality...







[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
LB - Can you provide the formula's you used - because I have not been able to replicate?

I concur with Turkbear - not sure how this would really work, because the goal is to use field values or conditions - as in, change to a smaller font size if the length is too long. The example I used was dummied up only for testing.

It does appear to be a bug, isolated to Text Objects. It works fine outside. Thanks again for everyone's help. I at least stopped pulling my hair out.
 
Using the Orders table in the Xtreme database, set up a formula like this in the detail section:

stringvar x := "UPS";

Then insert a text box containing the Order Date (format it to show 3/1/99). Then select the date->format text->font style-> x+2 and enter:

stringvar x;
if {Orders.Ship Via} = x then
crBold else crItalic;

Then go into the x+2 for font size and enter:
stringvar x;
if {Orders.Ship Via} = x then
16 else 10;

You can now change the value of x in the detail formula and the changes will be reflected in the date in the text box.

-LB
 
LB - Test your instructions. In XI, when you go back into x-2 for font size, then the crBold and crItalic appear. Exactly as before.

I tested in Basic and Crystal Syntax, using both stringvar and numbervar. The result is always the same.

I do note however, that as long as you don't re-save the x-2, or make any edits and save, it seems to work. So, the code is in there - somewhere.

Another clue: For a field within a text object, Click on x-2 for Font Size - the Title in the blue bar is Font Style. Click on a field outside if a text objuect - the title in the bar is Font Size. Clearly this is a bug!

 
I did test this. I agree there is a bug. However, once you set the formulas in the conditional formula area, if you don't go back in, you can make changes in the master formula without a problem.

-LB
 
Thanks LB! I was misunderstanding. Your idea is a good workaround, that along with notes in the Style field (which gets copied) will explain the logic behind the workaround.

I was on a different track - thinking you found a way where the bug was avoided altogether.

FYI - I did report the bug to BO.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top