Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hi there, I am trying to make a field calculation using the TextStyleAdd, TextColor, and TextSize functions. So far I have gotten the size and style in there ok, so it seems, but now I need to add color to one specific part of the calculation...and I need help!!!! Here is what I have so far:

If(IsEmpty(AreaofSpecialty1); ""; TextSize(TextStyleAdd("Area(s) of Specialty: "; Bold); (12)) & AreaofSpecialty1) & If(IsEmpty(AreaofSpecialty2); ""; ", " & AreaofSpecialty2) & If(IsEmpty(AreaofSpecialty3); ""; ", " & AreaofSpecialty3)

I want the "Area(s) of Specialty" part to be in black as well as 12 point font, and bold. The rest of the field will show up in a 10pt reddish colored font with no style...so I don't want any part of my calculation to affect anything except where it will say "Area(s) of Specialty".

Any help someone could give me would be greatly appreciated!!!!

Thanks!!

Posted

Try:

Case ( not IsEmpty ( AreaofSpecialty1 & AreaofSpecialty2 & AreaofSpecialty3 ) ;

TextColor ( TextSize ( TextStyleAdd ( "Area(s) of Specialty ??? " ; Bold ) ; 12 ) ; 0 ) )

& AreaofSpecialty1

&

Case ( not IsEmpty ( AreaofSpecialty1 ) and not IsEmpty ( AreaofSpecialty2 ) ; ", " )

& AreaofSpecialty2

&

Case ( not IsEmpty ( AreaofSpecialty1 & AreaofSpecialty2 ) and not IsEmpty ( AreaofSpecialty3 ) ; ", " )

& AreaofSpecialty3

However, I like this one better:

Case (

not IsEmpty ( AreaofSpecialty1 & AreaofSpecialty2 & AreaofSpecialty3 ) ;

TextColor ( TextSize ( TextStyleAdd ( "Area(s) of Specialty : " ; Bold ) ; 12 ) ; 0 )

)

& Substitute ( TrimAll ( AreaofSpecialty1 & " " & AreaofSpecialty2 & " " & AreaofSpecialty3 ; 0 ; 0 ) ; " " ; ", " )

Posted

Okay the only thing I worry about with these, is that sometimes my Area of Specialty 1, 2, or 3 may be null...and they don't all three have to be populated for the label to appear...I want the label to appear if there is anything in any one of those fields...so will your calcs work for that?

Thanks a lot!!

Posted

8 combinations?? Why would I need to test 8? I wouldn't think it would take TOO long. But I do already have the data loaded inside of filemaker (all my records), and there are over 50,000 records, so it has to run through them all before the change is applied and I can test it.

Posted

There are 3 fields, and each can be empty or not. That's 2^3 = 8 possible combinations.

If you don't want to test this, I guess you'll just have to take my word for it... but I wouldn't! giggle.gif

Posted

Also, I did try your first calculation above...and it didn't change the text color. I do have this inside a text box where everything else is in that reddish color I described before. Is this why it's not changing the font color? It also appears that it's not changing the font size...maybe also because of the text box...but it is bolding it. See, I have a text box that has different fields in it for Business information. They are inserted like this:

<<BusinessAddrLine1>>

<<BusinessAddrLine2>>

<<BusinessAddrLine3>>

<<BusinessCity>>

<<BusinessState>>

<<BusinessZip>>

<<BusinessCountry>>

etc, etc. And that text box is all one font size and color....with nothing in bold. Is this why my calc isn't working for the color and size?

Posted

I have a place on one of my layouts where I started typing text...so there are fields in there that are laid out like:

<<BusinessAddrLine1>>

<<BusinessAddrLine2>>

etc, etc. the reason I have them all together like this is because if I have separate fields laid out for each of these on my layout, then if one of those fields is null it would create an unappealing blank space between two fields that did have data. If you have them laid out as I have above, if a field is null, it will move the next field up and you won't be able to tell. So I put my calc for areas of specialty inside this same area so it looks like this:

<<AreaofSpecialtyLabel>>

And once I have put all the text into this area that I want, then I can right click and do text format, and set the text for the whole thing...so all of my fields will have that text format...I think this is why I am having the problem with the color and size. However, as a test I did remove my area of specialty label field from that textbox, and instead inserted the field on the layout. But since I want part of the text result to be one color, I changed the field text format to the color I want most of it to be, the reddish color, and chose the size too, but I want AreaofSpecialty 1, 2, and 3 to be that reddish color, and the label itself to be black, bold, and size 12. I tried it on the field, and used your first calc above, and it didn't make the text black or appear to change the size. Does this make any sense? I would send you my file if I could...but since I have the data in there, I can't due to company policy. And deleting the records would take a while, and then you would have to add one to test anyway. But I could send you screenshots if you thought it might be helpful. Sorry for all the confusion if I have caused any.

Posted

Formatting by one of the Text Formatting functions overrides any formatting you do in Layout mode. I have no idea why you should get different results.

Can you save a copy of your file as a clone (no records) and attach that?

Posted

I think I will have to make the two parts separate...like one field for the label itself, and another field for the list of the specialties. Then I can have them both formatted how I want...separately...cause the calculations are not working properly.

This topic is 7141 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.