Showing posts with label color. Show all posts
Showing posts with label color. Show all posts

Friday, February 24, 2012

IIF String Contains a value?

I want to create an IIF expression that changes the color of a field based on if a string value contains a 4 or 5 Any ideas on how to accomplish this?

Hi,

You can write an iif() expression in the background color property of that field.

The following expression will help:

iif(instr("string5",5) or instr("string4",4),"Gray","White")

You can change the color by choosing what u require from the constants provided else custon color.

Somiya

|||Thanks, but I think I need a little more help. The value I need to look for will be in a string like "3,4,6,8" so I think I need the Like conparison function, but I'm not sure of the syntax

The psudo code is this:

If instrI(String) contains a 4 or instrI(String) contains 5 display in Red else Black

Do you know what the syntax should be for IIF with a like conparison?|||

i think the same expression should work in a way similar to Like.

An iff() expression with Like operator would be in this case:

iif(("3,4,6,8" Like "*4*") or ("3,4,6,8" Like "*5*") ,"Red",Black")

* is for any 4 preceeding and followed with any number of characters

Somiya

IIF Statment to compare two values in joined tables

Hi

I'm trying to compare two varchars to check if they are the same, if they are the same then the color must turn red, if not then they must remain black

SELECT *

from members m, client c

where C.ClientID = m.ClientID

AND c.ClientID in (87,86)

AND m.email in ('dassd@.fdskjh.com','asdfas@.sdfd.net', etc...)

my results will give me two of the same email addresses but with different ClientID's, now when it

finds the same email it needs to make them both "RED"

Please help, any advice would be helpful

Kind Regards

Carel Greaves

Two ways occur to me:

- add a COUNT(c.ClientId) and GROUP BY m.email to your sql query, then check that count when displaying the data in your report - if the count is greater than 1 then you can colour the email field red

- use a row group in your report, grouping by email address, then have the other fields following - but if you use this approach you won't need to colour the email addresses red, as it will be instantly obvious which addresses are assigned to more than one client

Sunday, February 19, 2012

iif expression...need to add another condition...

Ok,
This expression for the font color is great:
=IIf(Fields!Purchase.Value < 0, "Red", "CornflowerBlue")
It changes negatives to red, positives to CornflowerBlue.
However, I need 0 (zero values) to be White, so that there is the third
color.
Any help is appreciated.
Thanks,
TrintMy only suggestion is to have a nested "iff" I do this quite a bit.
=IIf(Fields!Purchase.Value < 0, "Red", IIF(Fields!Purchase.Value = 0,
"White","CornflowerBlue"))
Hope that works.
"trint" wrote:
> Ok,
> This expression for the font color is great:
> =IIf(Fields!Purchase.Value < 0, "Red", "CornflowerBlue")
> It changes negatives to red, positives to CornflowerBlue.
> However, I need 0 (zero values) to be White, so that there is the third
> color.
> Any help is appreciated.
> Thanks,
> Trint
>|||You might find it easier to maintain with this kind of approach:
=getPurchaseColour(Fields!Purchase.Value)
... and have a function like this (pseudocode)..
friend function getPurchaseColour(value) as string
if value<0 return "Red"
if value=0 return "White"
return "CornflowerBlue"
end function