Hello from France,
I know how to loop through fields of records and i know how to change the color of a specific field but i'm not able to mix the two operations…
Does someone know how to do it?
I'm using FMP 12.
It is best to leave text unformatted and apply formatting at the layout level instead using conditional formatting. For example, if you want a Status field to turn red when the value is 'Past Due' then conditional formatting can handle it nicely. Just select the field and set formula to=
Status = "Past Due" ... and make the fill red
Three reasons for not changing data itself off the top of my head? 1) Difficulty finding all partially formatted text to change it back, 2) different colors print in different darknesses when printing B&W and it looks bad and 3) wasted time with developing script coupled with wasted time (resource) when it runs. Conditional formatting polices itself ... no scripting to run and no data to chase down for correction.
So if you want to change the color of fields in a found set, what makes them different? It might make more sense to add a field which flags them with the difference ( status change, printed, posted etc ) or if User-specific, write the IDs to multi-line global or User record and let conditional formatting track it for you.
Are you talking about the text color? You wouldn't use a loop, you would just use a replace:
replace field contents - table::field = TextColor (table::field ; RGB(___;___;___) )
If you needed that inside of a loop, you could just use "set field" with the same calculation.
Use conditional formatting. If found count doesn't equal total record count then change the color of the text field.
Neither does it make sense to 'temporarily' color a found set since only the found records are being displayed so you must want them to retain their 'difference' even when mixed again with other records.
I think everything depends on what your end goal is. I agree that changing the text color is not a great idea. I've seen users copy and paste text from the web to fields and when we printed reports we had text showing up in all colors and sizes, which makes the report unreadable and plain ugly.
But what is it that you're aiming for?
agnes b. riley
filemaker and web development
TWO-TIME MAD DOG AWARD WINNER
FileMaker Certified in 10 and 11
Member, FileMaker Business Alliance
T: 877 917-9079 . C: 917-660-7221
Thank you all for your quick replies!
I'm new to this forum and quite a newbie to FileMaker Pro dev and looking to improve my skills through a current project.
Yes, i was talking about the text color and i already use the "replace field contents" action script when needed on a small subset of known fields (one line by field).
But for the case i'm talking about, i want to change the color of text of all the fields of the model for some records, and i have a lot of fields (95). So i thought of looping through all of the fields and applying the text color change but it didn't work.
LaRetta reply does gave me the solution, so evident, the newbie in me didn't se it
You're right of course, i set it up via conditionnal formatting (in all the models it make sense) and it's working like i want. Thanks.
i went that text color change route because i began with changing some strings found in certain fields to highlight problems. In that context i think it made sense to change text color here and there.
For the case here, i wanted to highlight not a string in a single field but an entire record that was wrong (must have not been present in the first place in the imported file) : in that context conditional formatting is a much better solution (and it work!).
vpell wrote: I want to change the color of text of all the fields of the model for some records, and i have a lot of fields (95). For the case here, i wanted to highlight not a string in a single field but an entire record that was wrong (must have not been present in the first place in the imported file)
I want to change the color of text of all the fields of the model for some records, and i have a lot of fields (95).
For the case here, i wanted to highlight not a string in a single field but an entire record that was wrong (must have not been present in the first place in the imported file)
You can attach conditional formatting to all the fields at once - select them all before assigning the conditional calculation. Another option is just to create a single rectangle *button (although do not attach a script-step to it). Place it over the row and attach the conditional format calc to it instead. Then make it transparent.
* It has never made sense that conditional formatting cannot be applied to graphic objects such as a rectangle or circle but it can be applied if you create a button (even if no script is attached at all) and conditional formatting can also be applied to a rectangle if it is specified as a button (even if the script is a single No Op with no steps). It is like those graphic objects were forgotten (more like ignored) as FileMaker moved forward. ;^)
BTW, can you mark the thread answered if it is?
Message was edited by: LaRetta
Create another field for status, make that large size on top of your layout and format that conditionally based on what you want to show.
Sometimes the easiest solution is the best.
download vCard (http://www.zerobluetech.com/docs/Agnes%20B.%20Riley.vcf.zip)
FileMaker Certified in 10 and 11 • Member, FileMaker Business Alliance
Store (http://store.zerobluetech.com/) | Blog (http://blog.zerobluetech.com/) | Facebook (http://www.facebook.com/zerobluetech) | Twitter (http://www.twitter.com/zerobluetech) | LinkedIn (http://www.linkedin.com/company/zeroblue-technology-solutions)
I am not sure that creating a field (which adds to definition clutter) is an easier (or better) solution compared to a simple transparent button unless the Status field were needed anyway. Keeping a transparent button on Developer layout for quick access to place in portals and rows is helpful - and then just change the conditional format calc as you copy and use it. It works a treat during data migrations to quickly change the view of data.
I am curious though how you would format the Status (which is probably just a text field) to display row highlight only. Can you explain a bit more of your idea? In version 11 we can use the 500 px size to make text disappear but that does not seem to work in 12. One could send the highlight to the back of the fields and set the text to the background but that is a kludge since developer may check change background color at some time.
If the field contains a number then we can set format to boolean and a single space for yes and no and disallow entry to the field (of course). Then conditional format will work on it to hide the text but it wouldn't be dynamic as such. Text block works also but they are more easily deleted by accident while working.
I've used boolean function to show and hide (and rename) display of values but never with conditional formatting, LOL.
Retrieving data ...