Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7045 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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 ) )

)

Posted

Or

TextColor( yourFieldName; If( yourFieldName = "√"; 1670450; 15408675 ) )

Posted

RGB( x; y; z ) = 256^2 * x + 256 * y + z

It is merely the decimal equivalent of the quadratic represented as RGB( ).

Posted

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.

Posted

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

Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.