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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR Formula using crBracketedNegatives

Status
Not open for further replies.

gmiller261

Programmer
Dec 11, 2007
8
US
Looking for a formula that give me the correct syntax to crBracketedNegatives

I have this (CR XI)

// This conditional formatting formula must return one of the following Negative Sign Constants:
//
// crNoNegativeSign
// crLeadingMinus
// crTrailingMinus
// crBracketedNegatives
//
if {GETACCTSFA995.ASSETS} < 0 then
crBracketedNegatives()
 
It looks like you are trying to format the asset field, so why wouldn't you just select (123) from the dropdown? Why do you need a conditional formula? It will only bracket it if negative.

-LB
 
Obviously I am a newbie. today.

That is what I want it to do. On negative numbers bracket the asset sum, otherwise default text number

Google gives me little to nothing.

Thanks
 
Just go to format field->number->customize->negative numbers->choose (123).

-LB
 

Sorry do not see Format Number. See Format Text, but nothing like yours.

The Formula Workshop - Editor knows about negatives with brackets. But the syntax seems cryptic to me.
 
Right click on your assets field->format field->number, etc. Asset IS a number field, isn't it?

-LB
 
right click gets me Format Text.

I assume it is a summation.

Total Assets: {@GTAssets}
 
It looks like you have the field placed in a text box. Right click on the text box->edit text->select {@GTAssets} only->right click->format text->numbers->customize, etc. If you have trouble with that, remove the field from the text box and then format it, and just align the field with the text.

-LB
 

Thanks that got me to the 'inner' field. But I got a dialog box that is labeled Custom Styles.

There is a 'Negatives' drop down box. The dropdown box only allows - and () as formats. The only way I can see [] brackets is to click the Formula Workshop button.

Then I am back to my first post syntax, in the formula editor.
 
Since you were showing () I assumed you were just calling them brackets. What you want is unusual, but you can accomplish it by first formatting the negative amount to use the parens in the dropdown. Then create a formula in the main report->field explorer->new:

replace(replace(totext({table.amt},2),"(","["),")","]")

-LB
 
LB,

I appreciate your effort. But there is a native formatting function (crBracketedNegatives).

I've tried several permutations of the following to no avail. I feel the CR developer sux big time. Where have they been in the last 10 years?

If {@GTAssets} < 0 Then
crBracketedNegatives
 
The crbracketednegatives returns parens, not brackets. Did you try my suggestion? I tested it and it worked. I have never seen anyone use square brackets for negatives, so I think it must be an unusual way to format negatives.

-LB
 

Sorry LB, I never doubted your solution would work.

I am told that crBracketedNegatives is supposed to [] the negative number.

They have a formula for (123) in the Custom Style dialog box for negative numbers.
 
I see that. But what they mean by brackets is: () NOT [].

-LB
 

Probably.

I can't even get that field to turn 'red' if it is negative. I am missing something basic about formulas.

I've seen this in IBM examples and mine does not work.

If {Customer.Last Year's Sales} > 100000 Then
crGreen
Else If {Customer.Last Year's Sales} < 15000 Then
crRed
Else
crBlack

 
For colors, you have to be in the formula area for colors. You would place your sales field in the detail section->right click->format field->font->color->x+2 and then enter:

If currentfieldvalue > 100000 Then
crGreen
Else If currentfieldvalue < 15000 Then
crRed
Else
crBlack

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top