I'm using a rdlc report.
I have a text field 'surname' and a boolean field 'sales'.
Depending on the value of the boolean field I want the text to be red or black.
Looking at examples I should be changing the text color.
But the label on the dialog box when I select 'expression' says 'Set expression for:Value' but I think I should be a able to select to set the expression for color.
I have the following expresion but it just displays the text "Black" and "Red" in the text box.
=IIF(Fields!sales.Value,"Black","Red")
Seems like you are putting expression for value of Textbox. Instead put for Font Color
=IIf(fields!sales.Value = "true","Black","Blue")
To set expression for fontcolor
Textbox properties --> color --> Expression.
Let me know if it works for you
IIF(Fields!MiCampo.value = "Bueno","Green","Red")
other solution...
Fields!MiCampo.value TYPE string
VALUE IS = "Orange"
In expression...
=Fields!MiCampo.value.ToString()
Related
The requirements from the customer state that a record's Comment and Description fields must be displayed in the same cell but the text of the Comment must be displayed in red while the Description should be black. Using a mutator, I can combine the 2 fields and display them in one cell, but I haven't seen how to make one have red text and the other black text within that cell.
Is there a way?
Thanks,
Matt
I wouldnt bother doing that, just use a Customer Formatter function
formatter:function(cell, formatterParams, onRendered){
return '<span style=color:red>' + cell.getRow().getData().Comment + '</span><P><span style=color:black>' + cell.getRow().getData().Description + '</span></p>';
}
How to suppress a Text Object field in Crystal Report based on Header Value.
I have 2 text object fields below the Header and I want to suppress one or other based on my header.
I.e. my header is dynamic and it gets different header value.
CASE 1. In certain case if the header is "ABC" then I want to suppress or hide the 1st text object.
CASE 2. If the header is "DEF" then I want to suppress or hide the 2nd text object.
To suppress just a field and not the entire header:
Right click on the first text object
Select Format Text from the menu
On the Common tab, find the checkbox labeled Suppress. Don't check it though.
Instead, click on the x+2 button on the right side.
Note: It is quite far away from the Suppress checkbox it belongs to. See screenshot below for help with finding the button.
In the formula box that appears, type your condition for suppressing the text box. For example, if you want to suppress the text field if the header is "ABC" then you may want to enter the following:
{#HeaderField} = "ABC"
Repeat for the next text field.
However, there may be an easier way for you to go about this. Instead of having two text objects, create one formula with an IF-THEN-ELSE statement within to determine which text is displayed.
For example:
If {groupname} = "ABC" then "first set of text"
Else if {groupname} = "DEF" then "second set of text"
Else "Error"
or
If {groupname} = "ABC" then "first set of text"
Else "second set of text"
or
Select {groupname}
Case "ABC": "first set of text"
Case "DEF": "second set of text"
Default: "Error"
I want to highlight the strings before and after '--'. Example good -- bad here i want to highlight good and bad. when ever the -- is comes then before and after the strings are become highlight. Is it possible.
Let's assume you have the following text in a field "mytext":
This text comes before -- this text comes after.
LiveCode (as most applications) does not allow discontinuous selections, so the 'select' command only works on continuous runs of text.
select word 1 to 3 of fld "mytext"
But you can simulate selection highlighting by setting the backgroundColor property of separate text runs:
put wordOffset("--",fld "mytext") into tWordIndex
set the backgroundColor of word 1 to tWordIndex - 1 of fld "mytext" to the hiliteColor
set the backgroundColor of word tWordIndex + 1 to -1 of fld "mytext" to the hiliteColor
Of course you can use any valid text chunk expression in the two 'set' statements, depending on what part of the text preceding and following the " -- " you want to "highlight".
To clear the backgroundColor from the field do this:
set the backgroundColor of char 1 to -1 of fld "mytext" to empty
I'm using Power Builder 10.5 and I'm having a problem that seems simple at first, but can't get near the solution.
Is it possible to color rows differently depending on a condition? I have a select statement that retrieves numerous rows, that have different status: status A means the row is active, ERR that something is wrong, F that is finished, and so on...
What I need is the color of the column with status "ERR" to be red, and the color of the column with status "A" to be green. All else columns may be white.
I can do only half the job at the moment. I've added a dummy field in my Data Window, called "color". For all the cells I've written this in the design view, background color properties..
IF ( color =1, 65280, 16777215)
Now I move to the clicked event of my OK button where I retrieve data...
dw_1.Retrieve()
FOR ll_=1 to dw_1.RowCount()
ls_status=dw_1.GetItemString(ll_,"status")
IF ls_status='A' THEN
dw_1.SetItem(ll_, 'color', 1)
ELSEIF ls_status='ERR' THEN
??????
END IF
NEXT
The part with question marks is where I can't move forward. This highlights all my rows where status is "OK" green, but I can't seem to get the error ones red. I've tried manipulating the code in background color properties (trying to give him a condition if color=2), but I just keep getting the "Expression not valid" message.
Modify method also didn't help me much, as I can't seem to make him color only does rows with "ERR" status using Modify method.
Any advice will help.
You should set your 'color' column in the SQL statement itself.
SQL something like
CASE status WHEN 'ERR' THEN 'R' WHEN 'A' THEN 'G' END
Then in an expression on the background color of the columns of your datawindow you can put something like
if (color[0] = 'R', RGB(255,0,0), if (color[0] = 'G', RGB(0,255,0), RGB(0,0,0)))
In the datawindow properties of the object or band, go to the background tab. The Color property has a little button with an equal sign (=) on it. Click that and write an expression to derive a RGB value based on the value of a column.
I wrote an article about this stuff here: PBDJ Article
You can use case statements in the computed property. Something like this:
case( status when 'ERR' then RGB(255,0,0) when 'A' then RGB(0,255,0) else RGB(0,0,0) )
I have an ssrs report where I have many pie charts with the fields pass and fail as well as up to 3 other miscellaneous fields and I wish to be able to color the pass always green and the fail always red but the other fields could be a default value. Is this even possible to do? I have seen code examples with code for custom color in pie charts but I have no clue how to do this and have not found where I would put my custom code. What im trying to do is slightly different from what all those other examples do whith only defining a few fields.
=Switch
(
Fields!ResultTypeDescription.Value = "Pass", "Green",
Fields!ResultTypeDescription.Value = "Fail", "Red",
Fields!ResultTypeDescription.Value = "Assigned To Machine", "Blue",
Fields!ResultTypeDescription.Value = "Not Yet Assigned", "Orange",
True , "Gray"
)
In order to get our dynamic coloring working,i overrode the colors from the palette. This is how it’s done. Right-click on the pie and select Series Properties. Select the Fill page and click the Expression (fx) button to define the color.