Jump to content
Server Maintenance This Week. ×

Format Text to Alternating List Color


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

Recommended Posts

What is a calculation I can use for conditional formating of a fields text color when on an odd portal row?

For example:

- if field is on portal row [even]; blue

- if field is on portal row [odd]; white

I'm looking for something like this so I can us a match field ID Field with the related human label on top. On a form view I would just simply make the top field a solid color and user could not see the ID field directly below it. But in my list views, I have alternating color, so obviously this does not work. I would HATE to have to sacrifice this attractive feature.

I wish a user could tab to "pop up list" this would solve everything sense a pop up displays its human value.

Any tips on this issue?

Thank you for your time!

Link to comment
Share on other sites

I AM using the alternate color option on the portal.

This is why I need to use this conditional text color trick. So I can hide it with the color of the row it is on. I want to hide the matchfield field and show the human field on top while being abole to see the alternating color background.

Link to comment
Share on other sites

Why hide the match field?

If it's a value list, format the match field to be a pop-up menu, and set the value list to display only the "human" values as the second field. Users will never see the match field values.

Link to comment
Share on other sites

The tricky part as you have discovered is that the conditional formatting calc has no easy mechanism for getting the portal row number. If it did, the simple thing would be to do...

Mod(thePortalRowNumber; 2)

That would be true for all odd numbers and false for all even.

Due to the wide variety of ways that portals can be filtered and sorted, using data from the related records is not immediately helpful. A serial number in the related field for example is not guaranteed to be sorted nor is it necessarily going to be consistently alternating odd and even numbers.

One way to determine the row number is to create an additional table occurrence of the portal's table. This is used by an unstored calculated field in the portal's table to tally up the number of portal rows that precede the current portal row. How this is done depends on the row sorting and the details of the relationship filtering.

Attached is an example that applies conditional formatting to the odd/even rows as you describe. As you can see it requires quite a bit of additional work to achieve this effect on a portal that displays related records sorted by ascending date.

CondFormatOddPortalRow_fp7.zip

Link to comment
Share on other sites

This is GREAT! Thank you for taking the time to send me this!

But you are not joking, it is a bit complex... I will have to weigh the benefits on this one.

Sometimes you get lucky on an "easy" solution and sometimes you don't.

Again, thank you, this is a super file.

Link to comment
Share on other sites

It looks like comment's use of Get(RecordNumber) does present the easy way of generating a useful number to determine if the portal row is even or odd.

It appears to be robust against different sort orders of the portal.

Thus the easy way is to add a single new calculated field (=Get(RecordNumber) field to the table appearing in the portal and use that in the Mod() function for conditional formatting.

Link to comment
Share on other sites

BRAVO!

I have implemented and tested this technique into my full solution and so far it works beautifully!

Now THATS and EASY fix.

Thank you, awesome, perfecto.... sweet.

Link to comment
Share on other sites

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