Conditional Formatting Issue (1 Viewer)

kenrav

New member
Local time
Today, 06:09
Joined
Jun 20, 2020
Messages
9
I have an integer, e.g. 240. I convert it to a variant in hh:mm format, e.g," 4:00". I then save this in a field in my table which is formatted as a string.

My report (based on my table) displays the value "4:00" in the report field. So far, so good.

I was hoping to do some conditional formatting in my report along the lines "Anything < "4:00" needs to be displayed in red." Unfortunately, it doesn't appear I can do conditional formatting on a string. Any one have any suggestions? The bottom line is to display the as "hh:mm" and utilize conditional formating.

Thanks!

Ken
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:09
Joined
Oct 29, 2018
Messages
15,573
Hi Ken. Of course you can do CF with Strings but probably not what you were hoping for. Since your text value came from a numeric value, perhaps you can simply convert the text back into a number suitable for your CF purposes.
 

kenrav

New member
Local time
Today, 06:09
Joined
Jun 20, 2020
Messages
9
Hi Ken. Of course you can do CF with Strings but probably not what you were hoping for. Since your text value came from a numeric value, perhaps you can simply convert the text back into a number suitable for your CF purposes.
Thanks for your help. Yes, I'm able to do CF in I stick with integers (which represent minutes.) Unfortunately, the user wants to see the result in "hh:mm" format.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:09
Joined
Oct 29, 2018
Messages
15,573
Thanks for your help. Yes, I'm able to do CF in I stick with integers (which represent minutes.) Unfortunately, the user wants to see the result in "hh:mm" format.
Hi. What's displayed doesn't have to be what's in the CF conditions and vice versa. For example, you could display "4:00" but use Expression Is: [SomeFieldReferemce]<240. Or use the same calculations you used to convert the values from one form to another.

PS. Thought of another example. One could display "Pass" or "Fail" and use a CF condition like, Expression Is: [Grade]<=75.
 
Last edited:

kenrav

New member
Local time
Today, 06:09
Joined
Jun 20, 2020
Messages
9
theDBguy -

Thanks for your help. Not sure what I did differently, but I'm now able to do CF on string values with no issue. Sometimes, if I make too many changes without compacting, my changes don't always happen. Maybe that's the case or maybe I phrased the condition differently. Again, thanks for your help!

Ken
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:09
Joined
Oct 29, 2018
Messages
15,573
theDBguy -

Thanks for your help. Not sure what I did differently, but I'm now able to do CF on string values with no issue. Sometimes, if I make too many changes without compacting, my changes don't always happen. Maybe that's the case or maybe I phrased the condition differently. Again, thanks for your help!

Ken
Hi Ken. Glad to hear you got it sorted out. Good luck with your project.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:09
Joined
Feb 19, 2002
Messages
32,259
Strings that represent something you think of as numeric will compare as strings rather than numbers. For example "10:00" will be less than "4:00". is that correct by your logic?

As theDBguy pointed out, compare the actual numeric value but put the condition in the bound control which is showing text. You just have to include the numeric field in your query but you don't have to display it anywhere.
 

Users who are viewing this thread

Top Bottom