Heathbo Posted October 9, 2005 Posted October 9, 2005 Is it possible to have multiple (as in not related) calculations in one field? For example. I have a field that displays a number based on a calculation. I also need the text of that field to change color to white if another field has white text. What would be the best way to combine these two calculations into one?
CobaltSky Posted October 9, 2005 Posted October 9, 2005 Hello Heathbo, What you're describing is certainly possible. It is probably best done by 'nesting' the calculations - ie placing one calculation inside another which applies the teext color. Eg: TextColor( YourFirstCalcBaseOnFieldOneHere ; PatternCount(GetAsCSS(FieldTwo); "color: #FFFFFF;") * 16777215) - which will make the result of the first calc white if there is any white text in FieldTwo, but otherwise it will be black. :)
Heathbo Posted October 10, 2005 Author Posted October 10, 2005 I tried what you said but it won't change the color of the text. Here is what I have. Maybe you can find what's wrong with it. TextColor( Case ( Att15 > 0 ; Att15 + PAtt Container) ; PatternCount(GetAsCSS(Att15); "color: #FFFFFF;"))
CobaltSky Posted October 10, 2005 Posted October 10, 2005 Well, Heathbo, You *say* you tried what I suggested - but there are several respects in which the calc expression you are using does not resemble the syntax in my previous post. For one thing, your field references within the Case( ) argument and within the GetAsCSS( ) function point to the same field ("Att15"), whereas your earlier explanation stated that you wished to base the calc result on one field but determine its color based on another. For another thing it looks as though you may be trying to add a container field to a number field (or, if "PAtt Container" is not a container field, you are using rather misleading field names). And last, but not least, you have omitted the final clause of the formula I recommended - the " * 16777215" bit - and it ain't going to work without that (that is the color number for white). :)
Heathbo Posted October 10, 2005 Author Posted October 10, 2005 Sorry to be misleading. This is what I meant. I have 3 fields. The one this calculation is in titled "Result". A field titled "PAtt Container" This is just a field that contains a number brought in by a drop down menu. A field titled "Att15" In some records this has a number and in some it doesn't. Thats why I was trying to link it to the Case ( Att15 > 0 ; Att15 + PAtt Container). Basically, if Att15 has a number, make this field (Result) that number + PAtt Container. Finally the text color calculation. Basically, if the text in Att15 is white, make the text in Result white. I hope this clears it up. Thanks for the help.
CobaltSky Posted October 10, 2005 Posted October 10, 2005 Fine, Heathbo, So use the syntax format that I suggested earlier and let us know how you go. :)
Heathbo Posted October 10, 2005 Author Posted October 10, 2005 It works perfectly!! Thank you soo much. I originally thought the "* 16777215" was multiply the result by 16777215. Obviously it doesn't do that. What does the star and number mean?
CobaltSky Posted October 10, 2005 Posted October 10, 2005 Hi Heathbo, The "* 16777215" multiplies the result of the PatternCount( ) function to 'scale' it to the integer value of white in the RGB color system. Ie when the PatternCount( ) function returns zero, you have 0 * 16777215 which is equal to zero, which is the color value of black, but when the PatternCount( ) function returns 1, you have 1 * 16777215, which is equal to 16,777,215 which supplies the color value of white to the TextColor( ) function. :)
Recommended Posts
This topic is 7081 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now