mKirk Posted August 12, 2005 Posted August 12, 2005 I have the following script I'm using to determine the textColor of a field based on its contents: If [ testData::r001 = "√" ] Set Field [ testData::r001; TextColor ( testData::r001 ; RGB ( 25 ; 125 ; 50 ) ) ] Else Set Field [ testData::r001; TextColor ( testData::r001 ; RGB ( 235 ; 30 ; 35 ) ) ] End If You'll note that I'm applying this to field "r001"...I have 100 of these types of fields ("r001" - "r100"). The question is can I apply this script to all of them without having to repeat the script 100 times? Thanks in advance for any assistance.
Slobey Posted August 12, 2005 Posted August 12, 2005 Now that I think about it, you should probably just make each field an auto enter calc with "do not replace existing value for field (if any)" unchecked; If ( r001 = "√"; TextColor ( r001 ; RGB ( 25 ; 125 ; 50 ) ); TextColor ( r001 ; RGB ( 235 ; 30 ; 35 ) ) )
-Queue- Posted August 12, 2005 Posted August 12, 2005 Or TextColor( yourFieldName; If( yourFieldName = "√"; 1670450; 15408675 ) )
Slobey Posted August 12, 2005 Posted August 12, 2005 Queue could you explain 1670450; 15408675. This is an alternative way to select color instead of 000;000;000?
-Queue- Posted August 12, 2005 Posted August 12, 2005 RGB( x; y; z ) = 256^2 * x + 256 * y + z It is merely the decimal equivalent of the quadratic represented as RGB( ).
mKirk Posted August 12, 2005 Author Posted August 12, 2005 Sorry...but I'm not sure I'm understanding any of the responses so far. Perhaps I worded my question poorly. I'm not having trouble getting the field to become the color I desire using the script I gave in the original post. What I was curious about was if there was a way to apply the textColor formatting to a group or range of fields without having to copy/paste the script 100 times and replace the field names.
-Queue- Posted August 12, 2005 Posted August 12, 2005 Yes, see attached. Slobey was suggesting that you make it easier on yourself and use an auto-enter calc with 'do not replace existing value' deselected for each of your rXXX fields. You will have to update your existing records. But any new ones will automatically change the color of the text appropriately when data is entered or modified. mKirk.zip
mKirk Posted August 12, 2005 Author Posted August 12, 2005 Ah! It was the... TextColor( GetField(Get(ActiveFieldName)); If( Get(ActiveFieldContents) = "√"; RGB ( 25 ; 125 ; 50 ); RGB ( 235 ; 30 ; 35 ) ) ) ...in a loop that I was missing. Thanks!
Recommended Posts
This topic is 7045 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