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

Font Color

Status
Not open for further replies.

198311

IS-IT--Management
Mar 2, 2006
26
DE
hello,
I have a problem with Font Color Formula in CrossTab in Target Field
I have two fields : good and target

this is my formula:

If {command.target}>{command.good} then
crred
else
crgreen

This works fine but for all targets :( Even target<good

What's wrong with this formula ??

bye


 
Can you provide some sample data that uses these two command fields? Have you placed {command.target} and {command.good} on the report to see if the values are what you expect? I'm wondering whether they are summaries developed in the command, for example.

-LB
 
The formula is designed to work for all targets, either red or green.

Did you mean to say that it's always red?

What is the data type?

A greater than sign works well against values, but not strings. You can convert strings to values using the VAL() function, if need be.

Stating that you have 2 fields is meaningless, state that you have 2 fields of type <whatever it is>

-k
 
hello,

good is INT
target is INT

I did differently this is my formula in CrossTab on the Target field:

if currentfieldvalue>{command.good} then red else green

Now it works :
Is red or green differently - this takes result form this forumla and put to another field . Form exmaple :
if In first field target>good then target is red , and into another field all targets are red . It looks like the first fild is the base for another , even the target<good

very strange,


???
 
This will only work correctly if {command.good} is actually the summary that would appear in the crosstab cell. Your command should be set up to return that summary value. If you need help with this, please copy your command into the thread, and also identify both your crosstab row and column fields.

-LB
 
hello,
I don't understand :(
My command.Good is a value from database
command.target is also form datebase

Thoes are only field

bye
 
The crosstab summarizes data, so the field you want to compare in the crosstab is a summary, and needs to be compared to some kind of summary.

For further help, please copy your command into the thread and also identify your crosstab row, column, and summary fields.

-LB
 
ok .
My Command

Data:DataTime
Good :Number
target:number
product:string[250]

rows:command.product
column : command.data
summaraized fields : sum of command.good , sum of command.target


formula FontColor for the target field:
if currentfieldvalue>command.good then crred else crgreen

:)

bye
 
Didn't you create the command? To copy it into the thread, you need to go to database->database expert->command->edit-> and copy it, then paste it into the thread.

The reason I'm asking for this, is I think you need to change the current command or add a new one in order to accomplish your goal.

-LB
 
ok:)
but my command is
"exec montly {?month} "

and montly procedure is a biggg procedure :)


bye
 
I don't know what you mean. I assumed that you had used "add command" as your datasource.

Let's try an entirely different approach, which uses variables in formatting formula areas. First create a formula {@0}:

whilereadingrecords;
0

Insert this as a third summary in the crosstab.

Next select your first summary (command.good) in one of the inner cells->right click->format field->common->suppress->x+2 and enter:

whileprintingrecords;
numbervar good := currentfieldvalue;
false;

Then select the second summary (command.target)-> right click->format field->common->suppress->x+2 and enter:

whileprintingrecords;
numbervar target := currentfieldvalue;
true;//this will suppress this summary, but we'll display it later.


Then select the summary for {@0})-> right click->format field->common->display string->x+2 and enter:

whileprintingrecords;
numbervar target;
totext(target)

For the same summary, now go to the border tab->color->background->x+2 and enter:

whileprintingrecords;
numbervar good;
numbervar target;

if target > good then crRed else crGreen

This will conditionally color the display of the target field (which is now showing for the {@0} summary). Then you can drag the borders of the suppressed target summary to minimize the row.

-LB
 
hello:)
this work - but values of {@0} are completely mix :)

for example in first field the target is 1000 but {@0} is 0 . in the second field target is 0 and {@0} is 1000 :)

I don't know why
??

bye
 
hello, I found the error :) {@0} must be at the thierd position :) Now It works. But the format of {@0} is for example : 123,00 or 3,00 - Can I change to 123 or 3 ??
 
Change this formula to:

whileprintingrecords;
numbervar target;
totext(target,0,"")

-LB
 
hello,


@lbass

BIG THANKS for Your GREAT HELP ! :):)
Now my report is perfect :)

bye.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top