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

Conditional Formatting?


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

Recommended Posts

Posted

Is it possible to apply conditional formatting to a layout in FM similar to excel, whereby alternating lines could be given different background colors for easier readability? (i.e., line 1 is gray, line 2 is white, line 3 is gray, line 4 is white)

Posted

Courtney:

You can do this within portals, which is one of the things that makes a portal so handy for showing lists of data.

-Stanley

Posted

Thanks for the response. Is there a particular term that would help me narrow down my search for how this is done?

~Courtney

Posted

Courtney:

If you know how to create a portal, double-click on the portal in layout mode, and you will see the option to "alternate background with" and then a color box, where you can choose your alternating color.

-Stanley

Posted

You can also use a global container field with two repetitions and one color stored in each, and a calculated container field equal to GetRepetition( gContainer, not Mod( Status(CurrentRecordNumber), 2 ) + 1 ), which will return the first repetition for odd records and the second for even ones. Put this field in your body part and format it as desired, making sure to disable entry into it.

Posted

You can also use a global container field with two repetitions and one color stored in each

Ok, got that set up, and named it gContainer.

and a calculated container field equal to GetRepetition( gContainer, not Mod( Status(CurrentRecordNumber), 2 ) + 1 ), which will return the first repetition for odd records and the second for even ones. Put this field in your body part and format it as desired, making sure to disable entry into it.

This makes sense to me, but I'm apparently doing something wrong, because I'm not getting anything in the calculated container field (which I named Background). I set up a layout to display each field separately, so I could maybe see what I was doing wrong, and my gContainer field displays the two colors horizontally as I set it to do, but the Background field does not display either one of the colors.

Any clues to what I may be missing?

Posted

Digging a little deeper... when you say "calculated container field" should that be a calculation, where the result is a container? Or a container field with an "auto-entered" value equal to the calculation? (I have tried both, but I suspect the latter is more correct than former.) Or is it something else altogether?

Posted

Well I figured it out just by modifying the formula:

If( Mod( Status(CurrentRecordNumber), 2 ) , GetRepetition( gContainer , 1 ) , GetRepetition( gContainer , 2 ) )

(Just posting in case anyone else is searching for a similar solution.)

~Courtney

Posted

Sorry, that should have been

GetRepetition( gContainer, (not Mod( Status(CurrentRecordNumber), 2 )) + 1 )

Posted

So now that I have my background color being generated properly, I'd like to generate two reports based on two different layouts (and sorted in two different ways). How can I make the background field update itself based on the sort (which changes the CurrentRecordNumber)? Relookup doesn't seem to be the answer.

~Courtney

Posted

I'm not sure I understand the question. The current record number is dependent on how the items in the found set are sorted. It naturally updates for each sort order, as long as the calculation is unstored. Record number 1 in one sort order may be record number 4 in another. In the first case, the calculation will contain the first color; in the second, it will contain the other color.

Posted

I figured out my problem or at least a way around the problem. Although the record numbers were changing according to the sort, as is logical, the "background" wasn't "recalculating" based on the new value of the record number. (Even a relookup would only change some fields and not others - I'm not sure why.) So I'm writing a script to clear all values in the "background" field, and do a relookup each time the sort is performed. Preliminary testing looks like this will make it work as expected.

Thanks for all your help.

~Courtney

Posted

Did you make the container calculation a calculation field or a container with an auto-enter calculation? It should be an unstored calculation field with a container result.

Posted

That fixed it! Thanks so much. I had a container field with an auto-enter calculation.

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